]> git.ipfire.org Git - thirdparty/git.git/commit
merge-ort: propagate callback errors from traverse_trees_wrapper()
authorElijah Newren <newren@gmail.com>
Tue, 21 Apr 2026 00:26:07 +0000 (00:26 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Apr 2026 23:22:19 +0000 (16:22 -0700)
commitf7a69261db0f268de967919fa1b7a226571069a9
treec7a41c6cdca624a16232d9095a844ef3fc6a4588
parent94f057755b7941b321fd11fec1b2e3ca5313a4e0
merge-ort: propagate callback errors from traverse_trees_wrapper()

traverse_trees_wrapper() saves entries from a first pass through
traverse_trees() and then replays them through the real callback
(collect_merge_info_callback).  However, the replay loop silently
discards the callback return value.  This means any error reported by
the callback during replay -- including a future check for malformed
trees -- would be ignored, allowing the merge to proceed with corrupt
state.

Capture the return value, stop the loop on negative (error) returns,
and propagate the error to the caller.  Note that the callback returns
a positive mask value on success, so we normalize non-negative returns
to 0 for the caller.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-ort.c