Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2011-01-10 13:37:26 +0300
committerJunio C Hamano <gitster@pobox.com>2011-01-10 20:10:54 +0300
commitea640cc691d56f7151c5ba654b09c4a987dbef93 (patch)
tree039b65f623af477163357db76ea98752641c8a2b /git-submodule.sh
parentcb198b3b67feb2c0a6f22199ec14fa48d18ac1ce (diff)
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 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh16
1 files changed, 14 insertions, 2 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index d3c583d011..ac371e6253 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -36,12 +36,24 @@ resolve_relative_url ()
die "remote ($remote) does not have a url defined in .git/config"
url="$1"
remoteurl=${remoteurl%/}
+ sep=/
while test -n "$url"
do
case "$url" in
../*)
url="${url#../}"
- remoteurl="${remoteurl%/*}"
+ case "$remoteurl" in
+ */*)
+ remoteurl="${remoteurl%/*}"
+ ;;
+ *:*)
+ remoteurl="${remoteurl%:*}"
+ sep=:
+ ;;
+ *)
+ die "cannot strip one component off url '$remoteurl'"
+ ;;
+ esac
;;
./*)
url="${url#./}"
@@ -50,7 +62,7 @@ resolve_relative_url ()
break;;
esac
done
- echo "$remoteurl/${url%/}"
+ echo "$remoteurl$sep${url%/}"
}
#