threads / patch / 63932

patcht6137-*.sh: fix test failure on cygwin

Subject: [PATCH] t6137-*.sh: fix test failure on cygwin

## tl;dr

3 messages between Aug 8, 2025 and Aug 9, 2025. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Ramsay Jones· Aug 8, 2025, 19:32 UTC · lore

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>
---
Hi Junio,

This test failure is not a regression for this cycle (it was a regression for v2.50.0-rc0), but it would be nice to get it applied before release, if possible.

[Hmm, I have just noticed that the 'skip_all' message could drop the redundant 'skipping: ' at the beginning - oh well! ;) ]

ATB, Ramsay Jones

 t/t6137-pathspec-wildcards-literal.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Show changes to t/t6137-pathspec-wildcards-literal.sh +6 −6
diff --git a/t/t6137-pathspec-wildcards-literal.sh b/t/t6137-pathspec-wildcards-literal.sh
index 20abad5667..17a03085ef 100755
--- a/t/t6137-pathspec-wildcards-literal.sh
+++ b/t/t6137-pathspec-wildcards-literal.sh
@@ -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 &&
-- 
2.50.0
Junio C Hamano· Aug 8, 2025, 20:33 UTC · re: Ramsay Jones · lore

Re: [PATCH] t6137-*.sh: fix test failure on cygwin

Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
> [Hmm, I have just noticed that the 'skip_all' message could drop the
> redundant 'skipping: ' at the beginning - oh well! ;) ]
Yeah, I see skip_all="# SKIP $skip_all" in test-lib.sh

Let me squash the following in, to further match the message we give when the test environment fails a test prerequisite.

 t/t6137-pathspec-wildcards-literal.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to diff +1 −1
diff --git c/t/t6137-pathspec-wildcards-literal.sh w/t/t6137-pathspec-wildcards-literal.sh
index 17a03085ef..e582378181 100755
--- c/t/t6137-pathspec-wildcards-literal.sh
+++ w/t/t6137-pathspec-wildcards-literal.sh
@@ -4,7 +4,7 @@ test_description='test wildcards and literals with git add/commit (subshell styl
 . ./test-lib.sh
 
 test_have_prereq BSLASHPSPEC || {
-	skip_all='skipping: needs BSLASHPSPEC (backslashes in pathspecs)'
+	skip_all='missing BSLASHPSPEC (backslashes in pathspecs)'
 	test_done
 }
 
Ramsay Jones· Aug 9, 2025, 11:50 UTC · re: Junio C Hamano · lore

Re: [PATCH] t6137-*.sh: fix test failure on cygwin

On 08/08/2025 21:33, Junio C Hamano wrote:
Show 26 quoted lines
> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
> 
>> [Hmm, I have just noticed that the 'skip_all' message could drop the
>> redundant 'skipping: ' at the beginning - oh well! ;) ]
> 
> Yeah, I see skip_all="# SKIP $skip_all" in test-lib.sh
> 
> Let me squash the following in, to further match the message we give
> when the test environment fails a test prerequisite.
> 
>  t/t6137-pathspec-wildcards-literal.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git c/t/t6137-pathspec-wildcards-literal.sh w/t/t6137-pathspec-wildcards-literal.sh
> index 17a03085ef..e582378181 100755
> --- c/t/t6137-pathspec-wildcards-literal.sh
> +++ w/t/t6137-pathspec-wildcards-literal.sh
> @@ -4,7 +4,7 @@ test_description='test wildcards and literals with git add/commit (subshell styl
>  . ./test-lib.sh
>  
>  test_have_prereq BSLASHPSPEC || {
> -	skip_all='skipping: needs BSLASHPSPEC (backslashes in pathspecs)'
> +	skip_all='missing BSLASHPSPEC (backslashes in pathspecs)'
>  	test_done
>  }
>  
LGTM. Thanks!

ATB, Ramsay Jones

← back to recent threads