diff options
author | Thomas Rast <trast@student.ethz.ch> | 2011-01-10 11:37:26 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-01-10 09:10:54 -0800 |
commit | ea640cc691d56f7151c5ba654b09c4a987dbef93 (patch) | |
tree | 039b65f623af477163357db76ea98752641c8a2b /t | |
parent | Git 1.7.0.9 (diff) | |
download | tgif-ea640cc691d56f7151c5ba654b09c4a987dbef93.tar.xz |
submodule: fix relative url parsing for scp-style origin
The function resolve_relative_url was not prepared to deal with an
scp-style origin 'user@host:path' in the case where 'path' is only a
single component. Fix this by extending the logic that strips one
path component from the $remoteurl.
Also add tests for both styles of URLs.
Noticed-by: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t7400-submodule-basic.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 1a4dc5f893..8b004f60d6 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -331,4 +331,42 @@ test_expect_success 'add submodules without specifying an explicit path' ' git config -f .gitmodules submodule.bare.path bare ' +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 |