Merge branch 'jc/history-missing-tree-errorfix'
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
This commit is contained in:
commit
d7e8ff8565
1 file changed
+4
@@ -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)) {
|
||||
|
||||
Reference in new issue
Block a user