3 test_description
='am --abort'
7 test_expect_success setup
'
14 git add file-1 file-2 &&
15 git commit -m initial &&
20 echo $i >otherfile-$i &&
21 git add otherfile-$i &&
23 git commit -a -m $i || break
25 git format-patch --no-numbered initial &&
26 git checkout -b side initial &&
27 echo local change >file-2-expect
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 &&
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/MERGE_RR
53 test_expect_success
"am --abort goes back after failed am$with3" '
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/MERGE_RR
65 test_expect_success
'am --abort will keep the local commits intact' '
66 test_must_fail git am 0004-*.patch &&
67 test_commit unrelated &&
68 git rev-parse HEAD >expect &&
70 git rev-parse HEAD >actual &&
71 test_cmp expect actual