(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'test cherry-picking an empty commit'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\n'> <'\techo first > file1 &&\n'> <'\tgit add file1 &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "first" &&\n'> <'\n'> <'\tgit checkout -b empty-branch &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty -m "empty" &&\n'> <'\n'> <'\techo third >> file1 &&\n'> <'\tgit add file1 &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty-message -m "" &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\tgit checkout -b empty-branch2 &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty -m "empty"\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'cherry-pick an empty commit'>)} { (SQ <'\n'> <'\tgit checkout master &&\n'> <'\ttest_expect_code 1 git cherry-pick empty-branch^\n'> ) } ) (C {<test_expect_success>} {(SQ <'index lockfile was removed'>)} {(SQ <'\n'> <'\ttest ! -f .git/index.lock\n'>)} ) (C {<test_expect_success>} {(SQ <'cherry-pick a commit with an empty message'>)} { (SQ <'\n'> <'\tgit checkout master &&\n'> <'\ttest_expect_code 1 git cherry-pick empty-branch\n'> ) } ) (C {<test_expect_success>} {(SQ <'index lockfile was removed'>)} {(SQ <'\n'> <'\ttest ! -f .git/index.lock\n'>)} ) (C {<test_expect_success>} {(SQ <'cherry-pick a commit with an empty message with --allow-empty-message'>)} { (SQ <'\n'> <'\tgit checkout -f master &&\n'> <'\tgit cherry-pick --allow-empty-message empty-branch\n'> ) } ) (C {<test_expect_success>} {(SQ <'cherry pick an empty non-ff commit without --allow-empty'>)} { (SQ <'\n'> <'\tgit checkout master &&\n'> <'\techo fourth >>file2 &&\n'> <'\tgit add file2 &&\n'> <'\tgit commit -m "fourth" &&\n'> <'\ttest_must_fail git cherry-pick empty-branch2\n'> ) } ) (C {<test_expect_success>} {(SQ <'cherry pick an empty non-ff commit with --allow-empty'>)} {(SQ <'\n'> <'\tgit checkout master &&\n'> <'\tgit cherry-pick --allow-empty empty-branch2\n'>)} ) (C {<test_expect_success>} {(SQ <'cherry pick with --keep-redundant-commits'>)} { (SQ <'\n'> <'\tgit checkout master &&\n'> <'\tgit cherry-pick --keep-redundant-commits HEAD^\n'> ) } ) (C {<test_expect_success>} {(SQ <'cherry-pick a commit that becomes no-op (prep)'>)} { (SQ <'\n'> <'\tgit checkout master &&\n'> <'\tgit branch fork &&\n'> <'\techo foo >file2 &&\n'> <'\tgit add file2 &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "add file2 on master" &&\n'> <'\n'> <'\tgit checkout fork &&\n'> <'\techo foo >file2 &&\n'> <'\tgit add file2 &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "add file2 on the side"\n'> ) } ) (C {<test_expect_success>} {(SQ <'cherry-pick a no-op without --keep-redundant'>)} { (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\tgit checkout fork^0 &&\n'> <'\ttest_must_fail git cherry-pick master\n'> ) } ) (C {<test_expect_success>} {(SQ <'cherry-pick a no-op with --keep-redundant'>)} { (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\tgit checkout fork^0 &&\n'> <'\tgit cherry-pick --keep-redundant-commits master &&\n'> <'\tgit show -s --format=%s >actual &&\n'> <'\techo "add file2 on master" >expect &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_done>}) ] )