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 -m complains of bogus numbers' '
35 # expect 129 here to distinguish between cases where
36 # there was nothing to cherry-pick
37 test_expect_code 129 git cherry-pick -m &&
38 test_expect_code 129 git cherry-pick -m foo b &&
39 test_expect_code 129 git cherry-pick -m -1 b &&
40 test_expect_code 129 git cherry-pick -m 0 b
43 test_expect_success 'cherry-pick explicit first parent of a non-merge' '
47 git cherry-pick -m 1 b &&
48 git diff --exit-code c --
52 test_expect_success 'cherry pick a merge without -m should fail' '
56 test_must_fail git cherry-pick c &&
57 git diff --exit-code a --
61 test_expect_success 'cherry pick a merge (1)' '
65 git cherry-pick -m 1 c &&
66 git diff --exit-code c
70 test_expect_success 'cherry pick a merge (2)' '
74 git cherry-pick -m 2 c &&
75 git diff --exit-code c
79 test_expect_success 'cherry pick a merge relative to nonexistent parent should fail' '
83 test_must_fail git cherry-pick -m 3 c
87 test_expect_success 'revert explicit first parent of a non-merge' '
92 git diff --exit-code a --
96 test_expect_success 'revert a merge without -m should fail' '
100 test_must_fail git revert c &&
101 git diff --exit-code c
105 test_expect_success 'revert a merge (1)' '
110 git diff --exit-code a --
114 test_expect_success 'revert a merge (2)' '
119 git diff --exit-code b --
123 test_expect_success 'revert a merge relative to nonexistent parent should fail' '
127 test_must_fail git revert -m 3 c &&
128 git diff --exit-code c