]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t0021, t5615: use $PWD instead of $(pwd) in PATH-like shell variables
authorJohannes Sixt <j6t@kdbg.org>
Fri, 11 Nov 2016 17:31:48 +0000 (18:31 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 11 Nov 2016 18:54:46 +0000 (10:54 -0800)
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 <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0021-conversion.sh
t/t5615-alternate-env.sh

index 9ff502773d07819b43d027a0a1ee0fdf98f77e93..b93cd44546f6933a313ebcc5fd273f2b953fa1c2 100755 (executable)
@@ -4,7 +4,7 @@ test_description='blob conversion via gitattributes'
 
 . ./test-lib.sh
 
-TEST_ROOT="$(pwd)"
+TEST_ROOT="$PWD"
 PATH=$TEST_ROOT:$PATH
 
 write_script <<\EOF "$TEST_ROOT/rot13.sh"
index 22d9d8178b23db2cdf2f7066059af43d44eae6e9..eec4137ca5b392743e29068f4fffae1ffb78d812 100755 (executable)
@@ -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
        EOF
 '
 
 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
        EOF