Merge branch 'bc/maint-diff-hunk-header-fix' into bc/master-diff-hunk-header-fix
[git/dscho.git] / t / t4151-am-abort.sh
blob4448aba7e0727b70a4e525e57ad21cd7e226c1f8
1 #!/bin/sh
3 test_description='am --abort'
5 . ./test-lib.sh
7 test_expect_success setup '
8 for i in a b c d e f g
9 do
10 echo $i
11 done >file-1 &&
12 cp file-1 file-2 &&
13 test_tick &&
14 git add file-1 file-2 &&
15 git commit -m initial &&
16 git tag initial &&
17 for i in 2 3 4 5 6
19 echo $i >>file-1 &&
20 echo $i >otherfile-$i &&
21 git add otherfile-$i &&
22 test_tick &&
23 git commit -a -m $i || break
24 done &&
25 git format-patch initial &&
26 git checkout -b side initial &&
27 echo local change >file-2-expect
30 for with3 in '' ' -3'
32 test_expect_success "am$with3 stops at a patch that does not apply" '
34 git reset --hard initial &&
35 cp file-2-expect file-2 &&
37 test_must_fail git am$with3 000[1245]-*.patch &&
38 git log --pretty=tformat:%s >actual &&
39 for i in 3 2 initial
41 echo $i
42 done >expect &&
43 test_cmp expect actual
46 test_expect_success "am$with3 --skip continue after failed am$with3" '
47 test_must_fail git am$with3 --skip >output &&
48 test "$(grep "^Applying" output)" = "Applying: 6" &&
49 test_cmp file-2-expect file-2 &&
50 test ! -f .git/rr-cache/MERGE_RR
53 test_expect_success "am --abort goes back after failed am$with3" '
54 git am --abort &&
55 git rev-parse HEAD >actual &&
56 git rev-parse initial >expect &&
57 test_cmp expect actual &&
58 test_cmp file-2-expect file-2 &&
59 git diff-index --exit-code --cached HEAD &&
60 test ! -f .git/rr-cache/MERGE_RR
63 done
65 test_done