]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t6137-*.sh: fix test failure on cygwin
authorRamsay Jones <ramsay@ramsayjones.plus.com>
Fri, 8 Aug 2025 19:32:02 +0000 (20:32 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Aug 2025 20:30:00 +0000 (13:30 -0700)
Commit 6fd1106aa4 ("t3700: Skip a test with backslashes in pathspec",
2009-03-13) introduced the BSLASHPSPEC prerequisite. This prerequisite
allows tests to check for systems that can use backslashes in pathspecs
(e.g. to escape glob special characters). On windows (and cygwin), this
does not work because backslashes are used as directory separators, and
git eagerly converts them to forward slashes.

This test file uses the FUNNYNAMES prerequisite to skip this test file
on windows, despite not really being appropriate for this test, which
does not hold on cygwin. The FUNNYNAMES prerequisite is set when the
system can create files with embedded quotes ("), tabs or newlines in
the name. Since cygwin can satisfy FUNNYNAMES, but not BSLASHPSPEC, this
leads to test failures on cygwin.

In order to skip these tests on cygwin, replace the FUNNYNAMES prerequisite
with BSLASHPSPEC, so that this test file is skipped on both windows and
cygwin. While here, fix a few test titles as well.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6137-pathspec-wildcards-literal.sh

index 20abad5667df28e0cd136a02b157a05b3b4dfcb4..17a03085ef396daecae0ffd7bd74fd18c50e0bf9 100755 (executable)
@@ -3,8 +3,8 @@ test_description='test wildcards and literals with git add/commit (subshell styl
 
 . ./test-lib.sh
 
-test_have_prereq FUNNYNAMES || {
-       skip_all='skipping: needs FUNNYNAMES (non-Windows only)'
+test_have_prereq BSLASHPSPEC || {
+       skip_all='skipping: needs BSLASHPSPEC (backslashes in pathspecs)'
        test_done
 }
 
@@ -184,7 +184,7 @@ test_expect_success 'add wildcard f?z' '
        )
 '
 
-test_expect_success 'add literal \? literal' '
+test_expect_success 'add literal \?' '
        git init test-q-lit &&
        (
                cd test-q-lit &&
@@ -241,7 +241,7 @@ test_expect_success 'add literal hello\?world' '
        )
 '
 
-test_expect_success 'add literal [abc]' '
+test_expect_success 'add literal \[abc\]' '
        git init test-brackets-lit &&
        (
                cd test-brackets-lit &&
@@ -280,7 +280,7 @@ test_expect_success 'commit: wildcard *' '
        )
 '
 
-test_expect_success 'commit: literal *' '
+test_expect_success 'commit: literal \*' '
        git init test-c-asterisk-lit &&
        (
                cd test-c-asterisk-lit &&
@@ -328,7 +328,7 @@ test_expect_success 'commit: literal f\*' '
        )
 '
 
-test_expect_success 'commit: wildcard pathspec limits commit' '
+test_expect_success 'commit: wildcard f**' '
        git init test-c-pathlimit &&
        (
                cd test-c-pathlimit &&