mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Sixt <>
To: Junio C Hamano <>,
	Johannes Schindelin <>
Cc:, Jeff King <>
Subject: [PATCH] t0021, t5615: use $PWD instead of $(pwd) in PATH-like shell variables
Date: Fri, 11 Nov 2016 18:31:48 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

We have to use $PWD instead of $(pwd) because on Windows the latter
would add a C: style path to bash's Unix-style $PATH variable, which
becomes confused by the colon after the drive letter. ($PWD is a
Unix-style path.)

In the case of GIT_ALTERNATE_OBJECT_DIRECTORIES, bash on Windows
assembles a Unix-style path list with the colon as separators. It
converts the value to a Windows-style path list with the semicolon as
path separator when it forwards the variable to git.exe. The same
confusion happens when bash's original value is contaminated with
Windows style paths.

Signed-off-by: Johannes Sixt <>
Am 11.11.2016 um 18:11 schrieb Johannes Sixt:
> Am 11.11.2016 um 18:06 schrieb Junio C Hamano:
>> Johannes Schindelin <> writes:
>>> That test made the incorrect assumption that the path separator
>>> character
>>> is always a colon. On Windows, it is a semicolon instead.
>> Documentation/git.txt says that GIT_ALTERNATE_OBJECT_DIRECTORIES is
>> separated with ";" on Windows fairly clearly, and we should have
>> caught that.
>> For the upcoming release there is no need for any further tweak on
>> your fix I am responding to, but in the longer term we would want to
>> turn this to path_sep=";" (or ":") and define it in the global
>> t/, as it is plausible that we may want to prepend or
>> append to $PATH in the tests and that also needs ";" on Windows, no?

When the MSYS program such as bash invokes a non-MSYS program, it
translates the Unix-style paths in arguments and environment variables
to Windows stlye. We only have to ensure that we inject only Unix-style
paths in these places so as not to confuse the conversion algorithm.
Most of the time, we do not have to worry.

On the other hand, when we write a path to a file that git.exe consumes
or receive a path from git.exe, i.e., when the path travels through
stdout and stdin, no automatic translation happens (which is quite
understandable), and we have do the translation explicitly. An example
for such a case is when we write a .git/info/alternates file via the

> A simpler fix is to use $PWD instead of $(pwd). I'll submit a patch in a
> moment.

Here it is. I had proposed the t0021 part earlier, but it fell through
the cracks during the temporary maintainer change.

 t/    | 2 +-
 t/ | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/ b/t/
index 9ff502773d..b93cd44546 100755
--- a/t/
+++ b/t/
@@ -4,7 +4,7 @@ test_description='blob conversion via gitattributes'
 . ./
 write_script <<\EOF "$TEST_ROOT/"
diff --git a/t/ b/t/
index 22d9d8178b..eec4137ca5 100755
--- a/t/
+++ b/t/
@@ -31,14 +31,14 @@ test_expect_success 'objects inaccessible without alternates' '
 test_expect_success 'access alternate via absolute path' '
-	check_obj "$(pwd)/one.git/objects" <<-EOF
+	check_obj "$PWD/one.git/objects" <<-EOF
 	$one blob
 	$two missing
 test_expect_success 'access multiple alternates' '
-	check_obj "$(pwd)/one.git/objects:$(pwd)/two.git/objects" <<-EOF
+	check_obj "$PWD/one.git/objects:$PWD/two.git/objects" <<-EOF
 	$one blob
 	$two blob

  reply	other threads:[~2016-11-11 17:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-11 16:29 [PATCH] mingw: hot-fix t5615 Johannes Schindelin
2016-11-11 17:06 ` Junio C Hamano
2016-11-11 17:11   ` Johannes Sixt
2016-11-11 17:31     ` Johannes Sixt [this message]
2016-11-11 18:16       ` [PATCH] t0021, t5615: use $PWD instead of $(pwd) in PATH-like shell variables Jeff King
2016-11-11 18:55       ` Junio C Hamano
2016-11-12 11:40         ` Johannes Schindelin
2016-11-13  1:13           ` Junio C Hamano
2016-11-14  9:11             ` Lars Schneider
2016-11-14 16:35               ` Torsten Bögershausen
2016-11-14 17:01                 ` Jeff King
2016-11-14 19:45                   ` Ramsay Jones
2016-11-14 17:21               ` Junio C Hamano
2016-11-15 16:54                 ` Johannes Schindelin
2016-11-16  9:47                   ` Johannes Schindelin
2016-11-16 21:51                     ` Junio C Hamano
2016-11-11 18:12 ` [PATCH] mingw: hot-fix t5615 Jeff King

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:

  List information:

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

  git send-email \ \ \ \ \ \ \

* 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

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).