]> asedeno.scripts.mit.edu Git - git.git/blob - t/t4151-am-abort.sh
git-am: Add colon before the subject that is printed out as being applied
[git.git] / t / t4151-am-abort.sh
1 #!/bin/sh
2
3 test_description='am --abort'
4
5 . ./test-lib.sh
6
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
18         do
19                 echo $i >>file-1 &&
20                 test_tick &&
21                 git commit -a -m $i || break
22         done &&
23         git format-patch initial &&
24         git checkout -b side initial &&
25         echo local change >file-2-expect
26 '
27
28 for with3 in '' ' -3'
29 do
30         test_expect_success "am$with3 stops at a patch that does not apply" '
31
32                 git reset --hard initial &&
33                 cp file-2-expect file-2 &&
34
35                 test_must_fail git am$with3 000[1245]-*.patch &&
36                 git log --pretty=tformat:%s >actual &&
37                 for i in 3 2 initial
38                 do
39                         echo $i
40                 done >expect &&
41                 test_cmp expect actual
42         '
43
44         test_expect_success "am$with3 --skip continue after failed am$with3" '
45                 test_must_fail git-am$with3 --skip >output &&
46                 test "$(grep "^Applying" output)" = "Applying: 6" &&
47                 test_cmp file-2-expect file-2 &&
48                 test ! -f .git/rr-cache/MERGE_RR
49         '
50
51         test_expect_success "am --abort goes back after failed am$with3" '
52                 git-am --abort &&
53                 git rev-parse HEAD >actual &&
54                 git rev-parse initial >expect &&
55                 test_cmp expect actual &&
56                 test_cmp file-2-expect file-2 &&
57                 git diff-index --exit-code --cached HEAD &&
58                 test ! -f .git/rr-cache/MERGE_RR
59         '
60
61 done
62
63 test_done