Subject: Re: [PATCH] t3070: skip ls-files tests with backslash patterns on Windows

From: Junio C Hamano <[email-masked]>
Date: Fri, 29 May 2026 05:25:35 +0900

"Kristofer Karlsson via GitGitGadget" <[email-masked]>
writes:

> From: Kristofer Karlsson <[email-masked]>
>
> On Windows (MINGW), backslashes in pathspecs are silently converted to
> forward slashes (directory separators), which changes the glob semantics.
> This causes 36 test failures in t3070-wildmatch when the "via ls-files"
> variants test patterns containing backslash escapes (e.g. '\[ab]',
> '[\-_]', '[A-\\]').
>
> The wildmatch function itself handles these patterns correctly — only the
> ls-files code path fails because pathspec parsing converts the
> backslashes before they reach the glob matcher.
>
> Skip these ls-files tests on platforms where BSLASHPSPEC is not set,
> which is the existing prereq that captures exactly this semantic:
> "backslashes in pathspec are not directory separators."
>
> Signed-off-by: Kristofer Karlsson <[email-masked]>
> ---

Thanks for noticing and addressing this.  I think we fairly recently
started seeing this in GitHub actions CI, which puzzles me since
neither t3070 or wildmatch.[ch] have changed for quite some time.
8a6d158a (doc: document backslash in gitignore patterns, 2025-10-29)
added a few lines to the test about matching with backslash to t3070.

Two questions.

 * Has this been broken on Windows since October, or has something
   external change on Windows recently?  I do not know.  Anybody
   knows?

 * Is this change a workaround that sweeps ugly breakage under the
   rug, or is backslash inherently unusable as an excape character
   when handling paths on Windows (which I am afraid would make
   wildmatch fairly useless there)?

Will queue.  Thanks.