(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: { (DQ <'git merge\n'> <'\n'> <'Testing a custom strategy.\n'> <'\n'> <'* (HEAD, master) Merge commit \'c3\'\n'> <'|'> <'| * (tag: c3) c3\n'> <'* | (tag: c1) c1\n'> <'|/\n'> <'| * tag: c2) c2\n'> <'|/\n'> <'* (tag: c0) c0\n'> ) } spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <'set up custom strategy'>)} { (SQ <'\n'> <'\tcat >git-merge-theirs <<-EOF &&\n'> <'\t#!$SHELL_PATH\n'> <'\teval git read-tree --reset -u \\\\\\$\\$#\n'> <'\tEOF\n'> <'\n'> <'\tchmod +x git-merge-theirs &&\n'> <'\tPATH=.:$PATH &&\n'> <'\texport PATH\n'> ) } ) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\ttest_commit c0 c0.c &&\n'> <'\ttest_commit c1 c1.c &&\n'> <'\tgit reset --keep c0 &&\n'> <'\techo c1c1 >c1.c &&\n'> <'\tgit add c1.c &&\n'> <'\ttest_commit c2 c2.c &&\n'> <'\tgit reset --keep c0 &&\n'> <'\ttest_commit c3 c3.c\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge c2 with a custom strategy'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\n'> <'\tgit rev-parse c1 >head.old &&\n'> <'\tgit rev-parse c2 >second-parent.expected &&\n'> <'\tgit rev-parse c2^{tree} >tree.expected &&\n'> <'\tgit merge -s theirs c2 &&\n'> <'\n'> <'\tgit rev-parse HEAD >head.new &&\n'> <'\tgit rev-parse HEAD^1 >first-parent &&\n'> <'\tgit rev-parse HEAD^2 >second-parent &&\n'> <'\tgit rev-parse HEAD^{tree} >tree &&\n'> <'\tgit update-index --refresh &&\n'> <'\tgit diff --exit-code &&\n'> <'\tgit diff --exit-code c2 HEAD &&\n'> <'\tgit diff --exit-code c2 &&\n'> <'\n'> <'\t! test_cmp head.old head.new &&\n'> <'\ttest_cmp head.old first-parent &&\n'> <'\ttest_cmp second-parent.expected second-parent &&\n'> <'\ttest_cmp tree.expected tree &&\n'> <'\ttest -f c0.c &&\n'> <'\tgrep c1c1 c1.c &&\n'> <'\ttest -f c2.c\n'> ) } ) (C {<test_expect_success>} {(SQ <'trivial merge with custom strategy'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\n'> <'\tgit rev-parse c1 >head.old &&\n'> <'\tgit rev-parse c3 >second-parent.expected &&\n'> <'\tgit rev-parse c3^{tree} >tree.expected &&\n'> <'\tgit merge -s theirs c3 &&\n'> <'\n'> <'\tgit rev-parse HEAD >head.new &&\n'> <'\tgit rev-parse HEAD^1 >first-parent &&\n'> <'\tgit rev-parse HEAD^2 >second-parent &&\n'> <'\tgit rev-parse HEAD^{tree} >tree &&\n'> <'\tgit update-index --refresh &&\n'> <'\tgit diff --exit-code &&\n'> <'\tgit diff --exit-code c3 HEAD &&\n'> <'\tgit diff --exit-code c3 &&\n'> <'\n'> <'\t! test_cmp head.old head.new &&\n'> <'\ttest_cmp head.old first-parent &&\n'> <'\ttest_cmp second-parent.expected second-parent &&\n'> <'\ttest_cmp tree.expected tree &&\n'> <'\ttest -f c0.c &&\n'> <'\t! test -e c1.c &&\n'> <'\ttest -f c3.c\n'> ) } ) (C {<test_done>}) ] )