summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-01-13 11:34:39 -0800
committerJunio C Hamano <gitster@pobox.com>2011-01-13 11:34:39 -0800
commit4f93fc745ab4f51339ffb3b0e49a5f28a4c2a337 (patch)
tree92043345eeba362ecd1356a94067ec80d614021a /git-submodule.sh
parent3e70e37e72207e780ca1c6e86bbc3c2963e6038c (diff)
parentea640cc691d56f7151c5ba654b09c4a987dbef93 (diff)
downloadgit-4f93fc745ab4f51339ffb3b0e49a5f28a4c2a337.tar.gz
Merge branch 'tr/submodule-relative-scp-url'
* tr/submodule-relative-scp-url: submodule: fix relative url parsing for scp-style origin
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 c21b77aee5..8b90589717 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -37,12 +37,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#./}"
@@ -51,7 +63,7 @@ resolve_relative_url ()
break;;
esac
done
- echo "$remoteurl/${url%/}"
+ echo "$remoteurl$sep${url%/}"
}
#