Skip to content

Commit 776ffd1

Browse files
committed
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 <[email protected]>
1 parent 012c8b3 commit 776ffd1

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

t/t4126-apply-empty.sh

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,29 +66,28 @@ test_expect_success 'apply --index create' '
6666
git diff --exit-code
6767
'
6868

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 &&
7377
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 &&
7879
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" &&
8282
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" &&
8585
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" &&
8988
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"
9291
'
9392

9493
test_done

0 commit comments

Comments
 (0)