3 test_description
='cherry picking and reverting a merge
13 test_expect_success setup
'
18 git commit -m "Initial" &&
22 git commit -m "add line to A" A &&
26 git commit -m "add line to B" B &&
28 git checkout master &&
34 test_expect_success
'cherry-pick a non-merge with -m should fail' '
38 test_expect_code 128 git cherry-pick -m 1 b &&
39 git diff --exit-code a --
43 test_expect_success
'cherry pick a merge without -m should fail' '
47 test_must_fail git cherry-pick c &&
48 git diff --exit-code a --
52 test_expect_success
'cherry pick a merge (1)' '
56 git cherry-pick -m 1 c &&
57 git diff --exit-code c
61 test_expect_success
'cherry pick a merge (2)' '
65 git cherry-pick -m 2 c &&
66 git diff --exit-code c
70 test_expect_success
'cherry pick a merge relative to nonexistent parent should fail' '
74 test_must_fail git cherry-pick -m 3 c
78 test_expect_success
'revert a non-merge with -m should fail' '
82 test_must_fail git revert -m 1 b &&
83 git diff --exit-code c
87 test_expect_success
'revert a merge without -m should fail' '
91 test_must_fail git revert c &&
92 git diff --exit-code c
96 test_expect_success
'revert a merge (1)' '
101 git diff --exit-code a --
105 test_expect_success
'revert a merge (2)' '
110 git diff --exit-code b --
114 test_expect_success
'revert a merge relative to nonexistent parent should fail' '
118 test_must_fail git revert -m 3 c &&
119 git diff --exit-code c