]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/merge.c
merge: do not abort early if one strategy fails to handle the merge
authorElijah Newren <newren@gmail.com>
Sat, 23 Jul 2022 01:53:14 +0000 (01:53 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 23 Jul 2022 04:45:23 +0000 (21:45 -0700)
commit8f240b8bbb63591f15c10e43debaf564e63a66bd
treec8196e3c6655afe3c14072ac3bc146281c31a021
parente4cdfe84a0d2ac560bf0a2ab0e9beade5f71a844
merge: do not abort early if one strategy fails to handle the merge

builtin/merge is setup to allow multiple strategies to be specified,
and it will find the "best" result and use it.  This is defeated if
some of the merge strategies abort early when they cannot handle the
merge.  Fix the logic that calls recursive and ort to not do such an
early abort, but instead return "2" or "unhandled" so that the next
strategy can try to handle the merge.

Coming up with a testcase for this is somewhat difficult, since
recursive and ort both handle nearly any two-headed merge (there is
a separate code path that checks for non-two-headed merges and
already returns "2" for them).  So use a somewhat synthetic testcase
of having the index not match HEAD before the merge starts, since all
merge strategies will abort for that.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge.c
t/t6402-merge-rename.sh
t/t6424-merge-unrelated-index-changes.sh
t/t6439-merge-co-error-msgs.sh