submodule: Demonstrate known breakage during recursive merge

Since commit 68d03e4a (Implement automatic fast-forward merge for submodules, 2010-07-07) we try to suggest submodule commits that resolve a conflict. Consider a true recursive merge case b---bc / \ / o X \ / \ c---cb in which the two heads themselves (bc,cb) had resolved a submodule conflict (i.e. reference different commits than their parents). The submodule merge search runs during the temporary merge of the two merge bases (b,c) and prints out a suggestion that is not meaningful to the user. Then during the main merge the submodule merge search runs again but dies with the message fatal: --ancestry-path given but there are no bottom commits while trying to enumerate candidates. Demonstrate this known breakage with a new test in t7405-submodule-merge covering the case. Signed-off-by: Brad King <brad.king@kitware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brad King committed Oct 13, 2011 at 08:59 UTC 72251b7de6daf2cd7916e3aad46df0047e5a5d2b
1 file changed +51
t/t7405-submodule-merge.sh
+51
@@ -228,4 +228,55 @@ test_expect_success 'merging with a modify/modify conflict between merge bases'
228 git merge d
229 '
230
231 +# canonical criss-cross history in top and submodule
232 +test_expect_success 'setup for recursive merge with submodule' '
233 + mkdir merge-recursive &&
234 + (cd merge-recursive &&
235 + git init &&
236 + mkdir sub &&
237 + (cd sub &&
238 + git init &&
239 + test_commit a &&
240 + git checkout -b sub-b master &&
241 + test_commit b &&
242 + git checkout -b sub-c master &&
243 + test_commit c &&
244 + git checkout -b sub-bc sub-b &&
245 + git merge sub-c &&
246 + git checkout -b sub-cb sub-c &&
247 + git merge sub-b &&
248 + git checkout master) &&
249 + git add sub &&
250 + git commit -m a &&
251 + git checkout -b top-b master &&
252 + (cd sub && git checkout sub-b) &&
253 + git add sub &&
254 + git commit -m b &&
255 + git checkout -b top-c master &&
256 + (cd sub && git checkout sub-c) &&
257 + git add sub &&
258 + git commit -m c &&
259 + git checkout -b top-bc top-b &&
260 + git merge -s ours --no-commit top-c &&
261 + (cd sub && git checkout sub-bc) &&
262 + git add sub &&
263 + git commit -m bc &&
264 + git checkout -b top-cb top-c &&
265 + git merge -s ours --no-commit top-b &&
266 + (cd sub && git checkout sub-cb) &&
267 + git add sub &&
268 + git commit -m cb)
269 +'
270 +
271 +# merge should leave submodule unmerged in index
272 +test_expect_failure 'recursive merge with submodule' '
273 + (cd merge-recursive &&
274 + test_must_fail git merge top-bc &&
275 + echo "160000 $(git rev-parse top-cb:sub) 2 sub" > expect2 &&
276 + echo "160000 $(git rev-parse top-bc:sub) 3 sub" > expect3 &&
277 + git ls-files -u > actual &&
278 + grep "$(cat expect2)" actual > /dev/null &&
279 + grep "$(cat expect3)" actual > /dev/null)
280 +'
281 +
282 test_done