Skip to content

Commit f30e6c3

Browse files
dschogitster
authored andcommitted
merge-ort: do check parse_tree()'s return value
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]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d4bf193 commit f30e6c3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

merge-ort.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4379,9 +4379,11 @@ static int checkout(struct merge_options *opt,
43794379
unpack_opts.verbose_update = (opt->verbosity > 2);
43804380
unpack_opts.fn = twoway_merge;
43814381
unpack_opts.preserve_ignored = 0; /* FIXME: !opts->overwrite_ignore */
4382-
parse_tree(prev);
4382+
if (parse_tree(prev) < 0)
4383+
return -1;
43834384
init_tree_desc(&trees[0], prev->buffer, prev->size);
4384-
parse_tree(next);
4385+
if (parse_tree(next) < 0)
4386+
return -1;
43854387
init_tree_desc(&trees[1], next->buffer, next->size);
43864388

43874389
ret = unpack_trees(2, trees, &unpack_opts);

0 commit comments

Comments
 (0)