Re: [PATCH 2/2] git-sh-setup: work around Cygwin path handling gotchas
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 16, 2012, 19:02 UTC
- Message-ID
- <7vd364c5kt.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CAAXzdLW5VYnHc41WZ0id=4Qe17dHSj4+J9tqVvG-PvtpXLmh+Q@mail.gmail.com>
Steven Penny <svnpenn@gmail.com> writes:
Show 17 quoted lines
> Junio C Hamano wrote:
>> +*CYGWIN*)
>> + pwd () {
>> + builtin cygpath -m
>> + }
>> + ;;
>
> Ok I got it!
>
> The problem is twofold
>
> 1. Ramsay Jones was right, it needs to be called like
>
> cygpath -m "$PWD"
>
> 2. The Cygwin "pwd" (and quite possibly MinGW "pwd") needs to be defined
> **before** it is calledOK, I missed the first point, it seems. But you seem to have missed that these two problems are more or less independent---that is why I sent two patches, not a single ball of wax like the one I am responding to.
So the replacement for [PATCH 2/2] would now look like this?
In addition to "applies fine, tested and works" reports from Windows stakeholders, I still prefer to have a sign off from you (see Documentation/SubmittingPatches).
Thanks.
-- >8 -- From: Steven Penny <svnpenn@gmail.com> Date: Wed, 16 May 2012 10:44:49 -0700 Subject: [PATCH] git-sh-setup: work around Cygwin path handling gotchas
On Cygwin, tools built for Cygwin can take both Windows-style paths (e.g. C:/dir/file.txt or C:\dir\file.txt) and Cygwin-style paths (e.g. /cygdrive/c/dir/file.txt), but Windows-native tools can only take Windows-style paths. Because the paths that are relative to $GIT_DIR, e.g. the name of the insn sheet file of the "rebase -i" command, are given to the programs with $GIT_DIR prefixed, and $GIT_DIR in turn is computed by calling "pwd", wrap "pwd" to call "cygpath -m" to give a Windows-style path, in a way similar to how mingw does this. --- git-sh-setup.sh | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 770a86e..b8e6327 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -241,6 +241,11 @@ case $(uname -s) in return 1 } ;; +*CYGWIN*) + pwd () { + cygpath -m "$PWD" + } + ;; *) is_absolute_path () { case "$1" in
-- 1.7.10.2.537.g0ac6509