From: Jens Lehmann <Jens.Lehmann@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Antony Male <antony.male@gmail.com>,
Phil Hord <phil.hord@gmail.com>, Johannes Sixt <j6t@kdbg.org>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
msysGit Mailinglist <msysgit@googlegroups.com>
Subject: [PATCH v3 4/4] submodules: fix ambiguous absolute paths under Windows
Date: Sun, 04 Mar 2012 22:16:19 +0100 [thread overview]
Message-ID: <4F53DBA3.4010500@web.de> (raw)
In-Reply-To: <4F53DA95.2020402@web.de>
From: Johannes Sixt <j6t@kdbg.org>
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>
---
git-submodule.sh | 3 +++
1 file changed, 3 insertions(+)
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")"
--
1.7.9.2.362.g684a8
next prev parent reply other threads:[~2012-03-04 21:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-04 21:11 [PATCH v3 0/4] submodules: Use relative paths to gitdir and work tree Jens Lehmann
2012-03-04 21:14 ` [PATCH v3 1/4] submodules: always use a relative path to gitdir Jens Lehmann
2012-03-04 21:15 ` [PATCH v3 2/4] submodules: always use a relative path from gitdir to work tree Jens Lehmann
2012-03-04 21:15 ` [PATCH v3 3/4] submodules: refactor computation of relative gitdir path Jens Lehmann
2012-03-04 21:16 ` Jens Lehmann [this message]
2012-03-07 6:31 ` [PATCH v3 0/4] submodules: Use relative paths to gitdir and work tree Junio C Hamano
2012-03-07 20:40 ` Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F53DBA3.4010500@web.de \
--to=jens.lehmann@web.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=antony.male@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=msysgit@googlegroups.com \
--cc=phil.hord@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).