3 test_description
='git merge
5 Testing octopus merge when reducing parents to independent branches.'
14 # So 1, 2, 3 and 5 should be kept, 4 should be avoided.
16 test_expect_success
'setup' '
25 git reset --hard c0 &&
30 git reset --hard c0 &&
35 git reset --hard c0 &&
46 test_expect_success
'merge c1 with c2, c3, c4, c5' '
47 git reset --hard c1 &&
48 git merge c2 c3 c4 c5 &&
49 test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
50 test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&
51 test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
52 test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&
53 test "$(git rev-parse c5)" = "$(git rev-parse HEAD^4)" &&
54 git diff --exit-code &&
61 git show --format=%s -s >actual &&
69 test_expect_success
'pull c2, c3, c4, c5 into c1' '
70 git reset --hard c1 &&
71 git pull --no-rebase . c2 c3 c4 c5 &&
72 test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
73 test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&
74 test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
75 test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&
76 test "$(git rev-parse c5)" = "$(git rev-parse HEAD^4)" &&
77 git diff --exit-code &&
84 git show --format=%s -s >actual &&
92 test_expect_success
'setup' '
100 git reset --hard A &&
110 test_expect_success
'merge E and I' '
111 git reset --hard A &&
115 test_expect_success
'verify merge result' '
116 test $(git rev-parse HEAD^1) = $(git rev-parse E) &&
117 test $(git rev-parse HEAD^2) = $(git rev-parse I)
120 test_expect_success
'add conflicts' '
121 git reset --hard E &&
126 git reset --hard I &&
133 test_expect_success
'merge E2 and I2, causing a conflict and resolve it' '
134 git reset --hard A &&
135 test_must_fail git merge E2 I2 &&
138 git commit -m "resolve conflict"
141 test_expect_success
'verify merge result' '
142 test $(git rev-parse HEAD^1) = $(git rev-parse E2) &&
143 test $(git rev-parse HEAD^2) = $(git rev-parse I2)
146 test_expect_success
'fast-forward to redundant refs' '
147 git reset --hard c0 &&
151 test_expect_success
'verify merge result' '
152 test $(git rev-parse HEAD) = $(git rev-parse c5)
155 test_expect_success
'merge up-to-date redundant refs' '
156 git reset --hard c5 &&
160 test_expect_success
'verify merge result' '
161 test $(git rev-parse HEAD) = $(git rev-parse c5)