3 test_description='git-merge
5 Testing pull.* configuration parsing.'
9 test_expect_success 'setup' '
18 git reset --hard c0 &&
23 git reset --hard c0 &&
30 test_expect_success 'merge c1 with c2' '
31 git reset --hard c1 &&
41 test_expect_success 'merge c1 with c2 (ours in pull.twohead)' '
42 git reset --hard c1 &&
43 git config pull.twohead ours &&
49 test_expect_success 'merge c1 with c2 and c3 (recursive in pull.octopus)' '
50 git reset --hard c1 &&
51 git config pull.octopus "recursive" &&
52 test_must_fail git merge c2 c3 &&
53 test "$(git rev-parse c1)" = "$(git rev-parse HEAD)"
56 test_expect_success 'merge c1 with c2 and c3 (recursive and octopus in pull.octopus)' '
57 git reset --hard c1 &&
58 git config pull.octopus "recursive octopus" &&
60 test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
61 test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&
62 test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
63 test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&
64 git diff --exit-code &&
74 git diff-files --name-only
75 git ls-files --unmerged
82 # There are two conflicts here:
84 # 1) Because foo.c is renamed to bar.c, recursive will handle this,
87 # 2) One in conflict.c and that will always fail.
89 test_expect_success 'setup conflicted merge' '
90 git reset --hard c0 &&
93 echo contents >foo.c &&
102 git reset --hard c4 &&
103 echo C >conflict.c &&
104 git add conflict.c &&
105 echo secondline >> foo.c &&
111 # First do the merge with resolve and recursive then verify that
112 # recusive is choosen.
114 test_expect_success 'merge picks up the best result' '
115 git config pull.twohead "recursive resolve" &&
116 git reset --hard c5 &&
117 git merge -s resolve c6
118 resolve_count=$(conflict_count) &&
119 git reset --hard c5 &&
120 git merge -s recursive c6
121 recursive_count=$(conflict_count) &&
122 git reset --hard c5 &&
124 auto_count=$(conflict_count) &&
125 test $auto_count = $recursive_count &&
126 test $auto_count != $resolve_count