Skip to content

Commit b6d1e92

Browse files
committed
Merge branch 'js/mingw-spawn-with-spaces-in-path' into jch
Test fix. * js/mingw-spawn-with-spaces-in-path: t0061: fix test for argv[0] with spaces (MINGW only)
2 parents 1d1f746 + 71f4960 commit b6d1e92

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

t/t0061-run-command.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,23 @@ test_expect_success MINGW 'verify curlies are quoted properly' '
210210
test_cmp expect actual
211211
'
212212

213-
test_expect_success MINGW 'can spawn with argv[0] containing spaces' '
214-
cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" ./ &&
215-
test_must_fail "$PWD/test-fake-ssh$X" 2>err &&
216-
grep TRASH_DIRECTORY err
213+
test_expect_success MINGW 'can spawn .bat with argv[0] containing spaces' '
214+
bat="$TRASH_DIRECTORY/bat with spaces in name.bat" &&
215+
216+
# Every .bat invocation will log its arguments to file "out"
217+
rm -f out &&
218+
echo "echo %* >>out" >"$bat" &&
219+
220+
# Ask git to invoke .bat; clone will fail due to fake SSH helper
221+
test_must_fail env GIT_SSH="$bat" git clone myhost:src ssh-clone &&
222+
223+
# Spawning .bat can fail if there are two quoted cmd.exe arguments.
224+
# .bat itself is first (due to spaces in name), so just one more is
225+
# needed to verify. GIT_SSH will invoke .bat multiple times:
226+
# 1) -G myhost
227+
# 2) myhost "git-upload-pack src"
228+
# First invocation will always succeed. Test the second one.
229+
grep "git-upload-pack" out
217230
'
218231

219232
test_done

0 commit comments

Comments
 (0)