{"thread":{"id":"65708","subject":"[PATCH] t3070: skip ls-files tests with backslash patterns on Windows","startedAt":"2026-05-28T09:01:02Z","lastAt":"2026-06-03T14:23:13Z","messageCount":4,"participants":["Kristofer Karlsson via GitGitGadget","Junio C Hamano","Kristofer Karlsson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"544222","messageId":"pull.2128.git.1779958849319.gitgitgadget@gmail.com","threadId":"65708","inReplyTo":null,"subject":"[PATCH] t3070: skip ls-files tests with backslash patterns on Windows","fromName":"Kristofer Karlsson via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-05-28T09:00:48Z","receivedAt":"2026-05-28T09:01:02Z","isPatch":true,"body":"From: Kristofer Karlsson <krka@spotify.com>\n\nOn Windows (MINGW), backslashes in pathspecs are silently converted to\nforward slashes (directory separators), which changes the glob semantics.\nThis causes 36 test failures in t3070-wildmatch when the \"via ls-files\"\nvariants test patterns containing backslash escapes (e.g. '\\[ab]',\n'[\\-_]', '[A-\\\\]').\n\nThe wildmatch function itself handles these patterns correctly — only the\nls-files code path fails because pathspec parsing converts the\nbackslashes before they reach the glob matcher.\n\nSkip these ls-files tests on platforms where BSLASHPSPEC is not set,\nwhich is the existing prereq that captures exactly this semantic:\n\"backslashes in pathspec are not directory separators.\"\n\nSigned-off-by: Kristofer Karlsson <krka@spotify.com>\n---\n    t3070: skip ls-files tests with backslash patterns on Windows\n    \n    On Windows (MINGW), backslashes in pathspecs are silently converted to\n    forward slashes (directory separators), which changes the glob\n    semantics. This causes 36 test failures in t3070-wildmatch when the \"via\n    ls-files\" variants test patterns containing backslash escapes (e.g.\n    \\[ab], [\\-_], [A-\\\\]).\n    \n    The wildmatch function itself handles these patterns correctly — only\n    the ls-files code path fails because pathspec parsing converts the\n    backslashes before they reach the glob matcher.\n    \n    Skip these ls-files tests on platforms where BSLASHPSPEC is not set,\n    which is the existing prereq that captures exactly this semantic:\n    \"backslashes in pathspec are not directory separators.\"\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2128%2Fspkrka%2Fwildmatch-windows-fix-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2128/spkrka/wildmatch-windows-fix-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/2128\n\n t/t3070-wildmatch.sh | 19 +++++++++++++------\n 1 file changed, 13 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh\nindex 655bb1a0f2..3394122218 100755\n--- a/t/t3070-wildmatch.sh\n+++ b/t/t3070-wildmatch.sh\n@@ -99,6 +99,13 @@ match_with_ls_files() {\n \tmatch_function=$4\n \tls_files_args=$5\n \n+\tprereqs=EXPENSIVE_ON_WINDOWS\n+\tcase \"$pattern\" in\n+\t*\\\\*)\n+\t\tprereqs=\"$prereqs,BSLASHPSPEC\"\n+\t\t;;\n+\tesac\n+\n \tmatch_stdout_stderr_cmp=\"\n \t\ttr -d '\\0' <actual.raw >actual &&\n \t\ttest_must_be_empty actual.err &&\n@@ -108,36 +115,36 @@ match_with_ls_files() {\n \tthen\n \t\tif test -e .git/created_test_file\n \t\tthen\n-\t\t\ttest_expect_success EXPENSIVE_ON_WINDOWS \"$match_function (via ls-files): match dies on '$pattern' '$text'\" \"\n+\t\t\ttest_expect_success $prereqs \"$match_function (via ls-files): match dies on '$pattern' '$text'\" \"\n \t\t\t\tprintf '%s' '$text' >expect &&\n \t\t\t\ttest_must_fail git$ls_files_args ls-files -z -- '$pattern'\n \t\t\t\"\n \t\telse\n-\t\t\ttest_expect_failure EXPENSIVE_ON_WINDOWS \"$match_function (via ls-files): match skip '$pattern' '$text'\" 'false'\n+\t\t\ttest_expect_failure $prereqs \"$match_function (via ls-files): match skip '$pattern' '$text'\" 'false'\n \t\tfi\n \telif test \"$match_expect\" = 1\n \tthen\n \t\tif test -e .git/created_test_file\n \t\tthen\n-\t\t\ttest_expect_success EXPENSIVE_ON_WINDOWS \"$match_function (via ls-files): match '$pattern' '$text'\" \"\n+\t\t\ttest_expect_success $prereqs \"$match_function (via ls-files): match '$pattern' '$text'\" \"\n \t\t\t\tprintf '%s' '$text' >expect &&\n \t\t\t\tgit$ls_files_args ls-files -z -- '$pattern' >actual.raw 2>actual.err &&\n \t\t\t\t$match_stdout_stderr_cmp\n \t\t\t\"\n \t\telse\n-\t\t\ttest_expect_failure EXPENSIVE_ON_WINDOWS \"$match_function (via ls-files): match skip '$pattern' '$text'\" 'false'\n+\t\t\ttest_expect_failure $prereqs \"$match_function (via ls-files): match skip '$pattern' '$text'\" 'false'\n \t\tfi\n \telif test \"$match_expect\" = 0\n \tthen\n \t\tif test -e .git/created_test_file\n \t\tthen\n-\t\t\ttest_expect_success EXPENSIVE_ON_WINDOWS \"$match_function (via ls-files): no match '$pattern' '$text'\" \"\n+\t\t\ttest_expect_success $prereqs \"$match_function (via ls-files): no match '$pattern' '$text'\" \"\n \t\t\t\t>expect &&\n \t\t\t\tgit$ls_files_args ls-files -z -- '$pattern' >actual.raw 2>actual.err &&\n \t\t\t\t$match_stdout_stderr_cmp\n \t\t\t\"\n \t\telse\n-\t\t\ttest_expect_failure EXPENSIVE_ON_WINDOWS \"$match_function (via ls-files): no match skip '$pattern' '$text'\" 'false'\n+\t\t\ttest_expect_failure $prereqs \"$match_function (via ls-files): no match skip '$pattern' '$text'\" 'false'\n \t\tfi\n \telse\n \t\ttest_expect_success \"PANIC: Test framework error. Unknown matches value $match_expect\" 'false'\n\nbase-commit: c69baaf57ba26cf117c2b6793802877f19738b0d\n-- \ngitgitgadget\n"},{"id":"544236","messageId":"xmqqecivjn7k.fsf@gitster.g","threadId":"65708","inReplyTo":"pull.2128.git.1779958849319.gitgitgadget@gmail.com","subject":"Re: [PATCH] t3070: skip ls-files tests with backslash patterns on Windows","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-05-28T20:25:35Z","receivedAt":"2026-05-28T20:26:21Z","isPatch":true,"body":"\"Kristofer Karlsson via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Kristofer Karlsson <krka@spotify.com>\n>\n> On Windows (MINGW), backslashes in pathspecs are silently converted to\n> forward slashes (directory separators), which changes the glob semantics.\n> This causes 36 test failures in t3070-wildmatch when the \"via ls-files\"\n> variants test patterns containing backslash escapes (e.g. '\\[ab]',\n> '[\\-_]', '[A-\\\\]').\n>\n> The wildmatch function itself handles these patterns correctly — only the\n> ls-files code path fails because pathspec parsing converts the\n> backslashes before they reach the glob matcher.\n>\n> Skip these ls-files tests on platforms where BSLASHPSPEC is not set,\n> which is the existing prereq that captures exactly this semantic:\n> \"backslashes in pathspec are not directory separators.\"\n>\n> Signed-off-by: Kristofer Karlsson <krka@spotify.com>\n> ---\n\nThanks for noticing and addressing this.  I think we fairly recently\nstarted seeing this in GitHub actions CI, which puzzles me since\nneither t3070 or wildmatch.[ch] have changed for quite some time.\n8a6d158a (doc: document backslash in gitignore patterns, 2025-10-29)\nadded a few lines to the test about matching with backslash to t3070.\n\nTwo questions.\n\n * Has this been broken on Windows since October, or has something\n   external change on Windows recently?  I do not know.  Anybody\n   knows?\n\n * Is this change a workaround that sweeps ugly breakage under the\n   rug, or is backslash inherently unusable as an excape character\n   when handling paths on Windows (which I am afraid would make\n   wildmatch fairly useless there)?\n\nWill queue.  Thanks.\n"},{"id":"544258","messageId":"CAL71e4MLyEEWtrHvB2K+stZUq6s+5sQUpSjmos3F9aVo3ej=Fw@mail.gmail.com","threadId":"65708","inReplyTo":"xmqqecivjn7k.fsf@gitster.g","subject":"Re: [PATCH] t3070: skip ls-files tests with backslash patterns on Windows","fromName":"Kristofer Karlsson","fromEmail":"krka@spotify.com","sentAt":"2026-05-29T08:04:48Z","receivedAt":"2026-05-29T08:05:00Z","isPatch":true,"body":"On Thu, 28 May 2026 at 22:26, Junio C Hamano <gitster@pobox.com> wrote:\n> Two questions.\n>\n>  * Has this been broken on Windows since October, or has something\n>    external change on Windows recently?  I do not know.  Anybody\n>    knows?\n>\n>  * Is this change a workaround that sweeps ugly breakage under the\n>    rug, or is backslash inherently unusable as an excape character\n>    when handling paths on Windows (which I am afraid would make\n>    wildmatch fairly useless there)?\n>\n\nI am fairly new to the git ecosystem as a developer (not as a user),\nso I am not sure how long this has been broken. The backslash patterns\nin the ls-files test path predate 8a6d158a - patterns like 'foo\\*'\nand '[\\-_]' have been there since de8bada2bf (2018) - so it may\nhave been failing for a while before anyone noticed.\n\nMy thinking was that it would be good in general if the CI results\nwere green and did not include false positives for errors that we\nknow cannot work on this platform. The risk is that people stop\nlooking into CI failures in detail because they start to assume it\nis the same old backslash problem.\n\nThat said, there is also a risk that the real underlying issue does\nnot get fixed. I am hoping it is sufficient that the BSLASHPSPEC\nprereq and the case *\\\\* filter make it obvious to anyone reading\nthe test what we are skipping over and why.\n\n> Will queue.  Thanks.\n\nThanks! It felt a bit heavyweight to add noise to the list for trivial CI test\nchanges but I suppose the process is the same even if it does not\naffect the production code.\n"},{"id":"544619","messageId":"xmqqecinsnxt.fsf@gitster.g","threadId":"65708","inReplyTo":"CAL71e4MLyEEWtrHvB2K+stZUq6s+5sQUpSjmos3F9aVo3ej=Fw@mail.gmail.com","subject":"Re: [PATCH] t3070: skip ls-files tests with backslash patterns on Windows","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-06-03T14:23:10Z","receivedAt":"2026-06-03T14:23:13Z","isPatch":true,"body":"Kristofer Karlsson <krka@spotify.com> writes:\n\n> On Thu, 28 May 2026 at 22:26, Junio C Hamano <gitster@pobox.com> wrote:\n>> Two questions.\n>>\n>>  * Has this been broken on Windows since October, or has something\n>>    external change on Windows recently?  I do not know.  Anybody\n>>    knows?\n>>\n>>  * Is this change a workaround that sweeps ugly breakage under the\n>>    rug, or is backslash inherently unusable as an excape character\n>>    when handling paths on Windows (which I am afraid would make\n>>    wildmatch fairly useless there)?\n>>\n>\n> I am fairly new to the git ecosystem as a developer (not as a user),\n> so I am not sure how long this has been broken. The backslash patterns\n> in the ls-files test path predate 8a6d158a - patterns like 'foo\\*'\n> and '[\\-_]' have been there since de8bada2bf (2018) - so it may\n> have been failing for a while before anyone noticed.\n\nHmph.\n\n> My thinking was that it would be good in general if the CI results\n> were green and did not include false positives for errors that we\n> know cannot work on this platform. The risk is that people stop\n> looking into CI failures in detail because they start to assume it\n> is the same old backslash problem.\n\nOh, no question about that.\n\n> That said, there is also a risk that the real underlying issue does\n> not get fixed. I am hoping it is sufficient that the BSLASHPSPEC\n> prereq and the case *\\\\* filter make it obvious to anyone reading\n> the test what we are skipping over and why.\n>\n>> Will queue.  Thanks.\n>\n> Thanks! It felt a bit heavyweight to add noise to the list for trivial CI test\n> changes but I suppose the process is the same even if it does not\n> affect the production code.\n\nSure.  I just found it a little disturbing to declare that there\nwon't be ways on Windows to quote special letters with backslash\nwhen writing wildmatch patterns.  But if some Windows folks got\nmotivated enough, they are capable of lifting the prereq when they\nfix the underlying code as well, so it probably is not something I\nshould be worrying too much about.\n\nThanks.\n\n"}]}