t4126: fix "funny directory name" test on Windows (again)

Even though "git update-index --cacheinfo" ought to be filesystem agnostic, $ git update-index --add --cacheinfo "100644,$empty_blob,funny /empty" fails only on Windows, and this unfortunately makes the approach of the previous step unworkable. Resurrect the earlier approach to give up on running the test on known-bad platforms. Instead of computing a custom prerequisite, just use !MINGW we have used elsewhere. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Mar 29, 2024 at 10:21 UTC 776ffd1a303afa8cf581d62e9d0478d112fecdd2
1 file changed +17 -18
t/t4126-apply-empty.sh
+17 -18
@@ -66,29 +66,28 @@ test_expect_success 'apply --index create' '
66 git diff --exit-code
67 '
68
69 -test_expect_success 'parsing a patch with no-contents and a funny pathname' '
70 - git reset --hard &&
71 - empty_blob=$(test_oid empty_blob) &&
72 - echo "$empty_blob" >expect &&
69 +test_expect_success !MINGW 'apply with no-contents and a funny pathname' '
70 + test_when_finished "rm -fr \"funny \"; git reset --hard" &&
71 +
72 + mkdir "funny " &&
73 + >"funny /empty" &&
74 + git add "funny /empty" &&
75 + git diff HEAD -- "funny /" >sample.patch &&
76 + git diff -R HEAD -- "funny /" >elpmas.patch &&
77
74 - git update-index --add --cacheinfo "100644,$empty_blob,funny /empty" &&
75 - git diff --cached HEAD -- "funny /" >sample.patch &&
76 - git diff --cached -R HEAD -- "funny /" >elpmas.patch &&
77 - git reset &&
78 + git reset --hard &&
79
79 - git apply --cached --stat --check --apply sample.patch &&
80 - git rev-parse --verify ":funny /empty" >actual &&
81 - test_cmp expect actual &&
80 + git apply --stat --check --apply sample.patch &&
81 + test_must_be_empty "funny /empty" &&
82
83 - git apply --cached --stat --check --apply elpmas.patch &&
84 - test_must_fail git rev-parse --verify ":funny /empty" &&
83 + git apply --stat --check --apply elpmas.patch &&
84 + test_path_is_missing "funny /empty" &&
85
86 - git apply -R --cached --stat --check --apply elpmas.patch &&
87 - git rev-parse --verify ":funny /empty" >actual &&
88 - test_cmp expect actual &&
86 + git apply -R --stat --check --apply elpmas.patch &&
87 + test_must_be_empty "funny /empty" &&
88
90 - git apply -R --cached --stat --check --apply sample.patch &&
91 - test_must_fail git rev-parse --verify ":funny /empty"
89 + git apply -R --stat --check --apply sample.patch &&
90 + test_path_is_missing "funny /empty"
91 '
92
93 test_done