diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-03-07 15:59:41 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-07 15:59:41 -0800 |
commit | ae46d5fb98b316767f51a82fc0c1441174995a34 (patch) | |
tree | cc3dfac4a54bcdb534eb86be1f50a9791ea1a7c9 /sequencer.c | |
parent | 76d1cd8e5ec07889db43c15222d5632b90f525b2 (diff) | |
parent | 342990c7aaef5ac645e89101cb84569caf64baf4 (diff) | |
download | git-ae46d5fb98b316767f51a82fc0c1441174995a34.tar.gz |
Merge branch 'js/merge-tree-3-trees'
"git merge-tree" has learned that the three trees involved in the
3-way merge only need to be trees, not necessarily commits.
* js/merge-tree-3-trees:
fill_tree_descriptor(): mark error message for translation
cache-tree: avoid an unnecessary check
Always check `parse_tree*()`'s return value
t4301: verify that merge-tree fails on missing blob objects
merge-ort: do check `parse_tree()`'s return value
merge-tree: fail with a non-zero exit code on missing tree objects
merge-tree: accept 3 trees as arguments
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c index f49a871ac0..35dd7e561a 100644 --- a/sequencer.c +++ b/sequencer.c @@ -707,6 +707,8 @@ static int do_recursive_merge(struct repository *r, o.show_rename_progress = 1; head_tree = parse_tree_indirect(head); + if (!head_tree) + return error(_("unable to read tree (%s)"), oid_to_hex(head)); next_tree = next ? repo_get_commit_tree(r, next) : empty_tree(r); base_tree = base ? repo_get_commit_tree(r, base) : empty_tree(r); @@ -3882,6 +3884,8 @@ static int do_reset(struct repository *r, } tree = parse_tree_indirect(&oid); + if (!tree) + return error(_("unable to read tree (%s)"), oid_to_hex(&oid)); prime_cache_tree(r, r->index, tree); if (write_locked_index(r->index, &lock, COMMIT_LOCK) < 0) |