(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"test cherry-picking with --ff option">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\techo first > file1 &&\n"> <"\tgit add file1 &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m \"first\" &&\n"> <"\tgit tag first &&\n"> <"\n"> <"\tgit checkout -b other &&\n"> <"\techo second >> file1 &&\n"> <"\tgit add file1 &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m \"second\" &&\n"> <"\tgit tag second\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry-pick using --ff fast forwards">)} { (SQ <"\n"> <"\tgit checkout master &&\n"> <"\tgit reset --hard first &&\n"> <"\ttest_tick &&\n"> <"\tgit cherry-pick --ff second &&\n"> <"\ttest \"$(git rev-parse --verify HEAD)\" = \"$(git rev-parse --verify second)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry-pick not using --ff does not fast forwards">)} { (SQ <"\n"> <"\tgit checkout master &&\n"> <"\tgit reset --hard first &&\n"> <"\ttest_tick &&\n"> <"\tgit cherry-pick second &&\n"> <"\ttest \"$(git rev-parse --verify HEAD)\" != \"$(git rev-parse --verify second)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"merge setup">)} { (SQ <"\n"> <"\tgit checkout master &&\n"> <"\tgit reset --hard first &&\n"> <"\techo new line >A &&\n"> <"\tgit add A &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m \"add line to A\" A &&\n"> <"\tgit tag A &&\n"> <"\tgit checkout -b side first &&\n"> <"\techo new line >B &&\n"> <"\tgit add B &&\n"> <"\ttest_tick &&\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"> <"\tgit checkout -b new A\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry-pick a non-merge with --ff and -m should fail">)} { (SQ <"\n"> <"\tgit reset --hard A -- &&\n"> <"\ttest_must_fail git cherry-pick --ff -m 1 B &&\n"> <"\tgit diff --exit-code A --\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry pick a merge with --ff but without -m should fail">)} { (SQ <"\n"> <"\tgit reset --hard A -- &&\n"> <"\ttest_must_fail git cherry-pick --ff C &&\n"> <"\tgit diff --exit-code A --\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry pick with --ff a merge (1)">)} { (SQ <"\n"> <"\tgit reset --hard A -- &&\n"> <"\tgit cherry-pick --ff -m 1 C &&\n"> <"\tgit diff --exit-code C &&\n"> <"\ttest \"$(git rev-parse --verify HEAD)\" = \"$(git rev-parse --verify C)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry pick with --ff a merge (2)">)} { (SQ <"\n"> <"\tgit reset --hard B -- &&\n"> <"\tgit cherry-pick --ff -m 2 C &&\n"> <"\tgit diff --exit-code C &&\n"> <"\ttest \"$(git rev-parse --verify HEAD)\" = \"$(git rev-parse --verify C)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry pick a merge relative to nonexistent parent with --ff should fail">)} {(SQ <"\n"> <"\tgit reset --hard B -- &&\n"> <"\ttest_must_fail git cherry-pick --ff -m 3 C\n">)} ) (C {(test_expect_success)} {(SQ <"cherry pick a root commit with --ff">)} { (SQ <"\n"> <"\tgit reset --hard first -- &&\n"> <"\tgit rm file1 &&\n"> <"\techo first >file2 &&\n"> <"\tgit add file2 &&\n"> <"\tgit commit --amend -m \"file2\" &&\n"> <"\tgit cherry-pick --ff first &&\n"> <"\ttest \"$(git rev-parse --verify HEAD)\" = \"1df192cd8bc58a2b275d842cede4d221ad9000d1\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cherry-pick --ff on unborn branch">)} { (SQ <"\n"> <"\tgit checkout --orphan unborn &&\n"> <"\tgit rm --cached -r . &&\n"> <"\trm -rf * &&\n"> <"\tgit cherry-pick --ff first &&\n"> <"\ttest_cmp_rev first HEAD\n"> ) } ) (C {(test_done)}) ] )