ll-merge: killing the external merge driver aborts the merge
commit2b7b788fb31a74bcbff4e4c6efc6f3db6c3a49b7
authorJunio C Hamano <gitster@pobox.com>
Fri, 23 Jun 2023 00:33:01 +0000 (22 17:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 23 Jun 2023 16:27:10 +0000 (23 09:27 -0700)
treeb24e68a77ce2af1e69d9c384189067e98b2cd614
parent6640c2d06d112675426cf436f0594f0e8c614848
ll-merge: killing the external merge driver aborts the merge

When an external merge driver dies with a signal, we should not
expect that the result left on the filesystem is in any useful
state.  However, because the current code uses the return value from
run_command() and declares any positive value as a sign that the
driver successfully left conflicts in the result, and because the
return value from run_command() for a subprocess that died upon a
signal is positive, we end up treating whatever garbage left on the
filesystem as the result the merge driver wanted to leave us.

run_command() returns larger than 128 (WTERMSIG(status) + 128, to be
exact) when it notices that the subprocess died with a signal, so
detect such a case and return LL_MERGE_ERROR from ll_ext_merge().

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Documentation/gitattributes.txt
ll-merge.c
t/t6406-merge-attr.sh