unicode: update the width tables to Unicode 15
[git.git] / t / t4126-apply-empty.sh
blobece9fae207dbdbcc28a4ac999a351bd059c0968a
1 #!/bin/sh
3 test_description='apply empty'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success setup '
9 >empty &&
10 git add empty &&
11 test_tick &&
12 git commit -m initial &&
13 git commit --allow-empty -m "empty commit" &&
14 git format-patch --always HEAD~ >empty.patch &&
15 test_write_lines a b c d e >empty &&
16 cat empty >expect &&
17 git diff |
18 sed -e "/^diff --git/d" \
19 -e "/^index /d" \
20 -e "s|a/empty|empty.orig|" \
21 -e "s|b/empty|empty|" >patch0 &&
22 sed -e "s|empty|missing|" patch0 >patch1 &&
23 >empty &&
24 git update-index --refresh
27 test_expect_success 'apply empty' '
28 rm -f missing &&
29 test_when_finished "git reset --hard" &&
30 git apply patch0 &&
31 test_cmp expect empty
34 test_expect_success 'apply empty patch fails' '
35 test_when_finished "git reset --hard" &&
36 test_must_fail git apply empty.patch &&
37 test_must_fail git apply - </dev/null
40 test_expect_success 'apply with --allow-empty succeeds' '
41 test_when_finished "git reset --hard" &&
42 git apply --allow-empty empty.patch &&
43 git apply --allow-empty - </dev/null
46 test_expect_success 'apply --index empty' '
47 rm -f missing &&
48 test_when_finished "git reset --hard" &&
49 git apply --index patch0 &&
50 test_cmp expect empty &&
51 git diff --exit-code
54 test_expect_success 'apply create' '
55 rm -f missing &&
56 test_when_finished "git reset --hard" &&
57 git apply patch1 &&
58 test_cmp expect missing
61 test_expect_success 'apply --index create' '
62 rm -f missing &&
63 test_when_finished "git reset --hard" &&
64 git apply --index patch1 &&
65 test_cmp expect missing &&
66 git diff --exit-code
69 test_done