From: Junio C Hamano Date: Thu, 13 Jan 2011 19:34:39 +0000 (-0800) Subject: Merge branch 'tr/submodule-relative-scp-url' X-Git-Tag: v1.7.4-rc2~8 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4f93fc745ab4f51339ffb3b0e49a5f28a4c2a337;p=git.git Merge branch 'tr/submodule-relative-scp-url' * tr/submodule-relative-scp-url: submodule: fix relative url parsing for scp-style origin --- 4f93fc745ab4f51339ffb3b0e49a5f28a4c2a337 diff --cc t/t7400-submodule-basic.sh index 2c49db9f6,8b004f60d..874279e32 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@@ -413,37 -317,56 +413,75 @@@ test_expect_success 'submodule 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