summaryrefslogtreecommitdiff
path: root/list-objects.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-04-10 02:13:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-10 03:59:39 (GMT)
commit97dd512af7ce4afb4f638ef73b4770921c8ca3aa (patch)
treecf6d9bf042b2f6ebac6779c99350e8bbcf6470d1 /list-objects.c
parentee4dfee2274d2fd743066fa9fa4d37441ee522f8 (diff)
downloadgit-97dd512af7ce4afb4f638ef73b4770921c8ca3aa.zip
git-97dd512af7ce4afb4f638ef73b4770921c8ca3aa.tar.gz
git-97dd512af7ce4afb4f638ef73b4770921c8ca3aa.tar.bz2
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>
Diffstat (limited to 'list-objects.c')
-rw-r--r--list-objects.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/list-objects.c b/list-objects.c
index bb7e61e..b5651dd 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -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);