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>