author | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Jan 2011 18:37:25 +0000 (10:37 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Jan 2011 18:37:25 +0000 (10:37 -0800) |
* tr/submodule-relative-scp-url:
submodule: fix relative url parsing for scp-style origin
submodule: fix relative url parsing for scp-style origin
1 | 2 | |||
---|---|---|---|---|
git-submodule.sh | patch | | diff1 | | diff2 | | blob | history |
t/t7400-submodule-basic.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc git-submodule.sh
Simple merge
diff --cc t/t7400-submodule-basic.sh
index 2c49db9f6244225db7f82b574f21f05b58bfdc26,8b004f60d68561d0a4d6701bfc0ad8525a596117..874279e32da98ac2c20137a207a0d115f073e444
test_expect_success 'add submodules without specifying an explicit path' '
mkdir repo &&
- cd repo &&
- git init &&
- echo r >r &&
- git add r &&
- git commit -m "repo commit 1" &&
- cd .. &&
+ (
+ cd repo &&
+ git init &&
+ echo r >r &&
+ git add r &&
+ 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_expect_success 'set up for relative path tests' '
+ mkdir reltest &&
+ (
+ cd reltest &&
+ git init &&
+ mkdir sub &&
+ (
+ cd sub &&
+ git init &&
+ test_commit foo
+ ) &&
+ git add sub &&
+ git config -f .gitmodules submodule.sub.path sub &&
+ git config -f .gitmodules submodule.sub.url ../subrepo &&
+ cp .git/config pristine-.git-config
+ )
+ '
+
+ test_expect_success 'relative path works with URL' '
+ (
+ cd reltest &&
+ cp pristine-.git-config .git/config &&
+ git config remote.origin.url ssh://hostname/repo &&
+ git submodule init &&
+ test "$(git config submodule.sub.url)" = ssh://hostname/subrepo
+ )
+ '
+
+ test_expect_success 'relative path works with user@host:path' '
+ (
+ cd reltest &&
+ cp pristine-.git-config .git/config &&
+ git config remote.origin.url user@host:repo &&
+ git submodule init &&
+ test "$(git config submodule.sub.url)" = user@host:subrepo
+ )
+ '
+
test_done