(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: { (SQ <"cherry picking and reverting a merge\n"> <"\n"> <"\t\tb---c\n"> <"\t / /\n"> <"\tinitial---a\n"> <"\n"> ) } spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\n"> <"\t>A &&\n"> <"\t>B &&\n"> <"\tgit add A B &&\n"> <"\tgit commit -m \"Initial\" &&\n"> <"\tgit tag initial &&\n"> <"\tgit branch side &&\n"> <"\techo new line >A &&\n"> <"\tgit commit -m \"add line to A\" A &&\n"> <"\tgit tag a &&\n"> <"\tgit checkout side &&\n"> <"\techo new line >B &&\n"> <"\tgit commit -m \"add line to B\" B &&\n"> <"\tgit tag b &&\n"> <"\tgit checkout master &&\n"> <"\tgit merge side &&\n"> <"\tgit tag c\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry-pick a non-merge with -m should fail">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout a^0 &&\n"> <"\ttest_expect_code 128 git cherry-pick -m 1 b &&\n"> <"\tgit diff --exit-code a --\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry pick a merge without -m should fail">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout a^0 &&\n"> <"\ttest_must_fail git cherry-pick c &&\n"> <"\tgit diff --exit-code a --\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry pick a merge (1)">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout a^0 &&\n"> <"\tgit cherry-pick -m 1 c &&\n"> <"\tgit diff --exit-code c\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry pick a merge (2)">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout b^0 &&\n"> <"\tgit cherry-pick -m 2 c &&\n"> <"\tgit diff --exit-code c\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry pick a merge relative to nonexistent parent should fail">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout b^0 &&\n"> <"\ttest_must_fail git cherry-pick -m 3 c\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"revert a non-merge with -m should fail">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout c^0 &&\n"> <"\ttest_must_fail git revert -m 1 b &&\n"> <"\tgit diff --exit-code c\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"revert a merge without -m should fail">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout c^0 &&\n"> <"\ttest_must_fail git revert c &&\n"> <"\tgit diff --exit-code c\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"revert a merge (1)">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout c^0 &&\n"> <"\tgit revert -m 1 c &&\n"> <"\tgit diff --exit-code a --\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"revert a merge (2)">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout c^0 &&\n"> <"\tgit revert -m 2 c &&\n"> <"\tgit diff --exit-code b --\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"revert a merge relative to nonexistent parent should fail">)} { (SQ <"\n"> <"\n"> <"\tgit reset --hard &&\n"> <"\tgit checkout c^0 &&\n"> <"\ttest_must_fail git revert -m 3 c &&\n"> <"\tgit diff --exit-code c\n"> <"\n"> ) } ) (C {(test_done)}) ] )