Skip to content

Commit 45bf329

Browse files
dschogitster
authored andcommitted
t1300: fix the new --show-origin tests on Windows
On Windows, we have that funny situation where the test script can refer to POSIX paths because it runs in a shell that uses a POSIX emulation layer ("MSYS2 runtime"). Yet, git.exe does *not* understand POSIX paths at all but only pure Windows paths. So let's just convert the POSIX paths to Windows paths before passing them on to Git, using `pwd` (which is already modified on Windows to output Windows paths). While fixing the new tests on Windows, we also have to exclude the tests that want to write a file with a name that is illegal on Windows (unfortunately, there is more than one test trying to make use of that file). Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2ec2021 commit 45bf329

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

t/t1300-repo-config.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,9 @@ test_expect_success POSIXPERM,PERL 'preserves existing permissions' '
12051205
"die q(badrename) if ((stat(q(.git/config)))[2] & 07777) != 0600"
12061206
'
12071207

1208+
! test_have_prereq MINGW ||
1209+
HOME="$(pwd)" # convert to Windows path
1210+
12081211
test_expect_success 'set up --show-origin tests' '
12091212
INCLUDE_DIR="$HOME/include" &&
12101213
mkdir -p "$INCLUDE_DIR" &&
@@ -1304,7 +1307,7 @@ test_expect_success 'set up custom config file' '
13041307
EOF
13051308
'
13061309

1307-
test_expect_success '--show-origin escape special file name characters' '
1310+
test_expect_success !MINGW '--show-origin escape special file name characters' '
13081311
cat >expect <<-\EOF &&
13091312
file:"file\" (dq) and spaces.conf" user.custom=true
13101313
EOF
@@ -1333,7 +1336,7 @@ test_expect_success '--show-origin stdin with file include' '
13331336
test_cmp expect output
13341337
'
13351338

1336-
test_expect_success '--show-origin blob' '
1339+
test_expect_success !MINGW '--show-origin blob' '
13371340
cat >expect <<-\EOF &&
13381341
blob:a9d9f9e555b5c6f07cbe09d3f06fe3df11e09c08 user.custom=true
13391342
EOF
@@ -1342,7 +1345,7 @@ test_expect_success '--show-origin blob' '
13421345
test_cmp expect output
13431346
'
13441347

1345-
test_expect_success '--show-origin blob ref' '
1348+
test_expect_success !MINGW '--show-origin blob ref' '
13461349
cat >expect <<-\EOF &&
13471350
blob:"master:file\" (dq) and spaces.conf" user.custom=true
13481351
EOF

0 commit comments

Comments
 (0)