Skip to content

Commit

Permalink
merge-ort: do check parse_tree()'s return value
Browse files Browse the repository at this point in the history
The previous commit fixed a bug where a missing tree was reported, but
not treated as an error.

This patch addresses the same issue for the remaining two callers of
`parse_tree()`.

This change is not accompanied by a regression test because the code in
question is only reached at the `checkout` stage, i.e. after the merge
has happened (and therefore the tree objects could only be missing if
the disk had gone bad in that short time window, or something similarly
tricky to recreate in the test suite).

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Feb 5, 2024
1 parent a3e8ae8 commit 3e5b787
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions merge-ort.c
Original file line number Diff line number Diff line change
Expand Up @@ -4379,9 +4379,11 @@ static int checkout(struct merge_options *opt,
unpack_opts.verbose_update = (opt->verbosity > 2);
unpack_opts.fn = twoway_merge;
unpack_opts.preserve_ignored = 0; /* FIXME: !opts->overwrite_ignore */
parse_tree(prev);
if (parse_tree(prev) < 0)
return -1;
init_tree_desc(&trees[0], prev->buffer, prev->size);
parse_tree(next);
if (parse_tree(next) < 0)
return -1;
init_tree_desc(&trees[1], next->buffer, next->size);

ret = unpack_trees(2, trees, &unpack_opts);
Expand Down

0 comments on commit 3e5b787

Please sign in to comment.