Windows: Always normalize paths to Windows-style
commit72b9b6b550904a89ebccaf544b67656f606f9a59
authorHeiko Voigt <hvoigt@hvoigt.net>
Thu, 22 Mar 2012 18:17:03 +0000 (22 19:17 +0100)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Sun, 20 May 2012 23:45:20 +0000 (20 17:45 -0600)
tree0b93cb3f74090a6f8e4763a41b07e0bec5491770
parent930bfa07d87c8731b39c6c0da0c49f055d05d22f
Windows: Always normalize paths to Windows-style

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>
git-sh-setup.sh
git-submodule.sh