summaryrefslogtreecommitdiff
path: root/t/t7400-submodule-basic.sh
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2010-12-04 23:27:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-12-07 00:42:07 (GMT)
commit69e7236c6df44bfcde8913972b75a6ccb360d58f (patch)
tree3858142dcbd1a82116ce8e26bf6afebf4b610727 /t/t7400-submodule-basic.sh
parent502dc5b663fe3fe241accca5eda28a94d674fbb6 (diff)
downloadgit-69e7236c6df44bfcde8913972b75a6ccb360d58f.zip
git-69e7236c6df44bfcde8913972b75a6ccb360d58f.tar.gz
git-69e7236c6df44bfcde8913972b75a6ccb360d58f.tar.bz2
git submodule: Remove now obsolete tests before cloning a repo
Since 55892d23 "git clone" itself checks that the destination path is not a file but an empty directory if it exists, so there is no need anymore for module_clone() to check that too. Two tests have been added to test the behavior of "git submodule add" when path is a file or a directory (A subshell had to be added to the former last test to stay in the right directory). Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7400-submodule-basic.sh')
-rwxr-xr-xt/t7400-submodule-basic.sh28
1 files changed, 23 insertions, 5 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 782b0a3..2c49db9 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -421,11 +421,29 @@ test_expect_success 'add submodules without specifying an explicit path' '
git commit -m "repo commit 1"
) &&
git clone --bare repo/ bare.git &&
- cd addtest &&
- git submodule add "$submodurl/repo" &&
- git config -f .gitmodules submodule.repo.path repo &&
- git submodule add "$submodurl/bare.git" &&
- git config -f .gitmodules submodule.bare.path bare
+ (
+ cd addtest &&
+ git submodule add "$submodurl/repo" &&
+ git config -f .gitmodules submodule.repo.path repo &&
+ git submodule add "$submodurl/bare.git" &&
+ git config -f .gitmodules submodule.bare.path bare
+ )
+'
+
+test_expect_success 'add should fail when path is used by a file' '
+ (
+ cd addtest &&
+ touch file &&
+ test_must_fail git submodule add "$submodurl/repo" file
+ )
+'
+
+test_expect_success 'add should fail when path is used by an existing directory' '
+ (
+ cd addtest &&
+ mkdir empty-dir &&
+ test_must_fail git submodule add "$submodurl/repo" empty-dir
+ )
'
test_done