diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2024-02-23 09:34:20 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-02-23 19:19:39 +0100 |
commit | d4bf19308b81653cfb0d7b54489010dc1e0113b0 (patch) | |
tree | 83fade25eca331c2ac36678dfb49b37af07cdc89 /merge-ort.c | |
parent | merge-tree: accept 3 trees as arguments (diff) | |
download | git-d4bf19308b81653cfb0d7b54489010dc1e0113b0.tar.xz git-d4bf19308b81653cfb0d7b54489010dc1e0113b0.zip |
merge-tree: fail with a non-zero exit code on missing tree objects
When `git merge-tree` encounters a missing tree object, it should error
out and not continue quietly as if nothing had happened.
However, as of time of writing, `git merge-tree` _does_ continue, and
then offers the empty tree as result.
Let's fix this.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-ort.c')
-rw-r--r-- | merge-ort.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/merge-ort.c b/merge-ort.c index 6491070d96..c37fc035f1 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -1659,9 +1659,10 @@ static int collect_merge_info(struct merge_options *opt, info.data = opt; info.show_all_errors = 1; - parse_tree(merge_base); - parse_tree(side1); - parse_tree(side2); + if (parse_tree(merge_base) < 0 || + parse_tree(side1) < 0 || + parse_tree(side2) < 0) + return -1; init_tree_desc(t + 0, merge_base->buffer, merge_base->size); init_tree_desc(t + 1, side1->buffer, side1->size); init_tree_desc(t + 2, side2->buffer, side2->size); |