3 test_description
="git merge
5 Testing a custom strategy.
7 * (HEAD, master) Merge commit 'c3'
19 test_expect_success
'set up custom strategy' '
20 cat >git-merge-theirs <<-EOF &&
22 eval git read-tree --reset -u \\\$\$#
25 chmod +x git-merge-theirs &&
30 test_expect_success
'setup' '
31 test_commit c0 c0.c &&
32 test_commit c1 c1.c &&
33 git reset --keep c0 &&
36 test_commit c2 c2.c &&
37 git reset --keep c0 &&
41 test_expect_success
'merge c2 with a custom strategy' '
42 git reset --hard c1 &&
44 git rev-parse c1 >head.old &&
45 git rev-parse c2 >second-parent.expected &&
46 git rev-parse c2^{tree} >tree.expected &&
47 git merge -s theirs c2 &&
49 git rev-parse HEAD >head.new &&
50 git rev-parse HEAD^1 >first-parent &&
51 git rev-parse HEAD^2 >second-parent &&
52 git rev-parse HEAD^{tree} >tree &&
53 git update-index --refresh &&
54 git diff --exit-code &&
55 git diff --exit-code c2 HEAD &&
56 git diff --exit-code c2 &&
58 ! test_cmp head.old head.new &&
59 test_cmp head.old first-parent &&
60 test_cmp second-parent.expected second-parent &&
61 test_cmp tree.expected tree &&
67 test_expect_success
'trivial merge with custom strategy' '
68 git reset --hard c1 &&
70 git rev-parse c1 >head.old &&
71 git rev-parse c3 >second-parent.expected &&
72 git rev-parse c3^{tree} >tree.expected &&
73 git merge -s theirs c3 &&
75 git rev-parse HEAD >head.new &&
76 git rev-parse HEAD^1 >first-parent &&
77 git rev-parse HEAD^2 >second-parent &&
78 git rev-parse HEAD^{tree} >tree &&
79 git update-index --refresh &&
80 git diff --exit-code &&
81 git diff --exit-code c3 HEAD &&
82 git diff --exit-code c3 &&
84 ! test_cmp head.old head.new &&
85 test_cmp head.old first-parent &&
86 test_cmp second-parent.expected second-parent &&
87 test_cmp tree.expected tree &&