completion: fix PS1 display during an AM on detached HEAD
[git/spearce.git] / t / t4126-apply-empty.sh
blobceb6a79fe0c8ca5b26a9e148215556f2aa344eb9
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 rm -f missing &&
30 git apply patch0 &&
31 test_cmp expect empty
34 test_expect_success 'apply --index empty' '
35 git reset --hard &&
36 rm -f missing &&
37 git apply --index patch0 &&
38 test_cmp expect empty &&
39 git diff --exit-code
42 test_expect_success 'apply create' '
43 git reset --hard &&
44 rm -f missing &&
45 git apply patch1 &&
46 test_cmp expect missing
49 test_expect_success 'apply --index create' '
50 git reset --hard &&
51 rm -f missing &&
52 git apply --index patch1 &&
53 test_cmp expect missing &&
54 git diff --exit-code
57 test_done