rev-list: detect broken root trees
When the traversal machinery sees a commit without a root tree, it assumes that the tree was part of a BOUNDARY commit, and quietly ignores the tree. But it could also be caused by a commit whose root tree is broken or missing. Instead, let's die() when we see a NULL root tree. We can differentiate it from the BOUNDARY case by seeing if the commit was actually parsed. This covers that case, plus future-proofs us against any others where we might try to show an unparsed commit. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
ee4dfee227
commit
97dd512af7
@ -374,6 +374,9 @@ static void do_traverse(struct traversal_context *ctx)
|
||||
struct tree *tree = get_commit_tree(commit);
|
||||
tree->object.flags |= NOT_USER_GIVEN;
|
||||
add_pending_tree(ctx->revs, tree);
|
||||
} else if (commit->object.parsed) {
|
||||
die(_("unable to load root tree for commit %s"),
|
||||
oid_to_hex(&commit->object.oid));
|
||||
}
|
||||
ctx->show_commit(commit, ctx->show_data);
|
||||
|
||||
|
Reference in New Issue
Block a user