progress.c: avoid use of dynamic-sized array
[git/gitweb.git] / t / t4126-apply-empty.sh
blob0cfd47cfcff31fddfb9470654367a8f1ac261bfd
1 #!/bin/sh
3 test_description='apply empty'
5 . ./test-lib.sh
7 test_expect_success setup '
8 >empty &&
9 git add empty &&
10 test_tick &&
11 git commit -m initial &&
12 for i in a b c d e
14 echo $i
15 done >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 git reset --hard &&
29 >empty &&
30 rm -f missing &&
31 git apply patch0 &&
32 test_cmp expect empty
35 test_expect_success 'apply --index empty' '
36 git reset --hard &&
37 >empty &&
38 rm -f missing &&
39 git apply --index patch0 &&
40 test_cmp expect empty &&
41 git diff --exit-code
44 test_expect_success 'apply create' '
45 git reset --hard &&
46 >empty &&
47 rm -f missing &&
48 git apply patch1 &&
49 test_cmp expect missing
52 test_expect_success 'apply --index create' '
53 git reset --hard &&
54 >empty &&
55 rm -f missing &&
56 git apply --index patch1 &&
57 test_cmp expect missing &&
58 git diff --exit-code
61 test_done