summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2012-03-04 21:16:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-03-05 05:22:46 (GMT)
commit4dce7d9b408b2935b85721b54a2010eda7ec1be9 (patch)
treeb484dbd119913c5be6d25c969c5416d690490632 /git-submodule.sh
parent69c3051780d6cacfe242563296160634dc667a90 (diff)
downloadgit-4dce7d9b408b2935b85721b54a2010eda7ec1be9.zip
git-4dce7d9b408b2935b85721b54a2010eda7ec1be9.tar.gz
git-4dce7d9b408b2935b85721b54a2010eda7ec1be9.tar.bz2
submodules: fix ambiguous absolute paths under Windows
Under Windows the "git rev-parse --git-dir" and "pwd" commands may return either drive-letter-colon or POSIX style paths. This makes module_clone() behave badly because it expects absolute paths to always start with a '/'. Fix that by always converting the "c:/" notation into "/c/" when computing the relative paths from gitdir to the submodule work tree and back. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index a9e9822..efc86ad 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -151,6 +151,9 @@ module_clone()
a=$(cd "$gitdir" && pwd)/
b=$(cd "$path" && pwd)/
+ # normalize Windows-style absolute paths to POSIX-style absolute paths
+ case $a in [a-zA-Z]:/*) a=/${a%%:*}${a#*:} ;; esac
+ case $b in [a-zA-Z]:/*) b=/${b%%:*}${b#*:} ;; esac
# Remove all common leading directories after a sanity check
if test "${a#$b}" != "$a" || test "${b#$a}" != "$b"; then
die "$(eval_gettext "Gitdir '\$a' is part of the submodule path '\$b' or vice versa")"