git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stepan Kasal <kasal@ucw.cz>
To: GIT Mailing-list <git@vger.kernel.org>
Cc: Heiko Voigt <hvoigt@hvoigt.net>, Johannes Sixt <j6t@kdbg.org>
Subject: [PATCH] Windows: Always normalize paths to Windows-style
Date: Mon, 28 Apr 2014 16:29:31 +0200	[thread overview]
Message-ID: <20140428142931.GA12056@camelia.ucw.cz> (raw)
In-Reply-To: <CABPQNSbDkE+Vff=4MmPO9oMfjRay6Oin51zZRoZ8mOEhGoaD3Q@mail.gmail.com>

From: Heiko Voigt <hvoigt@hvoigt.net>
Date: Thu, 22 Mar 2012 19:17:03 +0100

It appears that `pwd` returns the POSIX-style or the DOS-style path
depending which style the previous `cd` used. To normalize, enforce `pwd
-W` in scripts.

>From the original e-mail exchange:

On Thu, Mar 22, 2012 at 11:13:37AM +0100, Sebastian Schuberth wrote:
> On Wed, Mar 21, 2012 at 22:21, Johannes Sixt <j6t@kdbg.org> wrote:
>
> > I build git and run its tests outside the msysgit environment. Does that
> > explain the difference? (And I use CMD.)
>
> It does not make a difference for me. I started cmd.exe at
> c:\msysgit\git\t, added c:\msysgit\bin temporarily to PATH, and ran
> "sh t5526-fetch-submodules.sh -i -v", and the test still fails.

Yes it probably does. Johannes said that he runs the tests outside of
the msysgit folder. That way there is only one path the submodule script
gets reported and not two like '/c/msysgit/git' and '/git'.

That would explain to me why it is passing.

I am afraid that the only solution is to patch msys itself to report the
long absolute path when passing window style paths to cd. Currently when
I do

	cd c:/msysgit/git

I will end up in '/git' instead of the long path.

I found that there is a -W option to pwd in msys bash which makes it
always return the real windows path. A normalization in that direction
is unique and thus might be more robust. Have a look at the attached
patch. With this at least t5526 passes. I was not able to run the whole
testsuite properly at the moment. I can have a look at that tomorrow.

What do you think?

Cheers Heiko

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

Hello,
this is another patch that lives in msysGit for a long time.
Originally, it had two parts:
(Cf https://github.com/msysgit/git/commit/64a8a03 )

1) adding alias pwd='pwd -W' to git-sh-setup.sh
   This one went upstream, though as a shell function.

2) revert of commit 4dce7d9b by Johannes Sixt <j6t@kdbg.org>
This mingw-specific commit was created less than 3 weeks before
it was reverted.  And it stayed reverted for two years.

Could you please either accept this patch, or revert 4dce7d9b ?
(Both alternatives are exactly the same.)

Have a nice day,
	Stepan Kasal

 git-submodule.sh | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 4a30087..247273e 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -285,9 +285,6 @@ module_clone()
 	# resolve any symlinks that might be present in $PWD
 	a=$(cd_to_toplevel && cd "$gitdir" && pwd)/
 	b=$(cd_to_toplevel && cd "$sm_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.9.2.msysgit.0.158.g6070cee

  reply	other threads:[~2014-04-28 14:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28  8:39 [PATCH] Sleep 1 millisecond in poll() to avoid busy wait Stepan Kasal
2014-04-28  9:07 ` Erik Faye-Lund
2014-04-28 11:38   ` Stepan Kasal
2014-04-28 11:42     ` [PATCH] poll/select: prevent busy-waiting Stepan Kasal
2014-04-28 11:44       ` Erik Faye-Lund
2014-04-28 14:29         ` Stepan Kasal [this message]
2014-04-28 15:26           ` [PATCH] Windows: Always normalize paths to Windows-style Stepan Kasal
2014-05-07 18:44           ` Heiko Voigt
2014-05-07 20:40             ` Junio C Hamano
2014-05-08 10:11               ` Stepan Kasal
2014-05-08 20:13                 ` Junio C Hamano
2014-05-08 20:36                   ` [PATCH] Revert "submodules: fix ambiguous absolute paths under Windows" Stepan Kasal
2014-04-28 15:05         ` [PATCH] poll/select: prevent busy-waiting Johannes Sixt
2014-04-28 15:35           ` [PATCH v2] Sleep 1 millisecond in poll() to avoid busy wait Stepan Kasal
2014-04-28 15:37             ` Erik Faye-Lund
2014-04-28 18:58               ` Junio C Hamano
2014-04-29  3:47                 ` Stepan Kasal
2014-04-29 16:51                   ` Junio C Hamano

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140428142931.GA12056@camelia.ucw.cz \
    --to=kasal@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=hvoigt@hvoigt.net \
    --cc=j6t@kdbg.org \
    /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.
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 NNTP newsgroup(s).