Merge branch 'jc/history-missing-tree-errorfix' into next

Running "git history" in a corrupt repository can (unsurprisingly)
segfault when a necessary tree object is not found.

* jc/history-missing-tree-errorfix:
  history: do not dereference NULL when parent tree is missing
next
Junio C Hamano 2026-09-10 05:42:21 -07:00
commit 36601bf096
1 changed files with 4 additions and 0 deletions

View File

@ -786,6 +786,10 @@ static int write_ondisk_index(struct repository *repo,
opts.dst_index = &index;

tree = repo_parse_tree_indirect(repo, oid);
if (!tree) {
ret = error(_("unable to parse tree %s"), oid_to_hex(oid));
goto out;
}
init_tree_desc(&tree_desc, &tree->object.oid, tree->buffer, tree->size);

if (unpack_trees(1, &tree_desc, &opts)) {