3 test_description
='git merge
5 Testing octopus merge when reducing parents to independent branches.'
7 TEST_PASSES_SANITIZE_LEAK
=true
15 # So 1, 2, 3 and 5 should be kept, 4 should be avoided.
17 test_expect_success
'setup' '
26 git reset --hard c0 &&
31 git reset --hard c0 &&
36 git reset --hard c0 &&
47 test_expect_success
'merge c1 with c2, c3, c4, c5' '
48 git reset --hard c1 &&
49 git merge c2 c3 c4 c5 &&
50 test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
51 test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&
52 test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
53 test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&
54 test "$(git rev-parse c5)" = "$(git rev-parse HEAD^4)" &&
55 git diff --exit-code &&
62 git show --format=%s -s >actual &&
70 test_expect_success
'pull c2, c3, c4, c5 into c1' '
71 git reset --hard c1 &&
72 git pull --no-rebase . c2 c3 c4 c5 &&
73 test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
74 test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&
75 test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
76 test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&
77 test "$(git rev-parse c5)" = "$(git rev-parse HEAD^4)" &&
78 git diff --exit-code &&
85 git show --format=%s -s >actual &&
93 test_expect_success
'setup' '
99 git tag $i || return 1
101 git reset --hard A &&
107 git tag $i || return 1
111 test_expect_success
'merge E and I' '
112 git reset --hard A &&
116 test_expect_success
'verify merge result' '
117 test $(git rev-parse HEAD^1) = $(git rev-parse E) &&
118 test $(git rev-parse HEAD^2) = $(git rev-parse I)
121 test_expect_success
'add conflicts' '
122 git reset --hard E &&
127 git reset --hard I &&
134 test_expect_success
'merge E2 and I2, causing a conflict and resolve it' '
135 git reset --hard A &&
136 test_must_fail git merge E2 I2 &&
139 git commit -m "resolve conflict"
142 test_expect_success
'verify merge result' '
143 test $(git rev-parse HEAD^1) = $(git rev-parse E2) &&
144 test $(git rev-parse HEAD^2) = $(git rev-parse I2)
147 test_expect_success
'fast-forward to redundant refs' '
148 git reset --hard c0 &&
152 test_expect_success
'verify merge result' '
153 test $(git rev-parse HEAD) = $(git rev-parse c5)
156 test_expect_success
'merge up-to-date redundant refs' '
157 git reset --hard c5 &&
161 test_expect_success
'verify merge result' '
162 test $(git rev-parse HEAD) = $(git rev-parse c5)