From b49e74eac480d167c3af8f1286fe520c3d7ce9e1 Mon Sep 17 00:00:00 2001 From: Taylor Blau Date: Tue, 9 Apr 2019 19:13:19 -0700 Subject: list-objects.c: handle unexpected non-tree entries Apply similar treatment as the previous commit for non-tree entries, too. Signed-off-by: Taylor Blau Signed-off-by: Junio C Hamano --- list-objects.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'list-objects.c') diff --git a/list-objects.c b/list-objects.c index ea04bbdee6..bb7e61ef4b 100644 --- a/list-objects.c +++ b/list-objects.c @@ -125,6 +125,11 @@ static void process_tree_contents(struct traversal_context *ctx, if (S_ISDIR(entry.mode)) { struct tree *t = lookup_tree(ctx->revs->repo, &entry.oid); + if (!t) { + die(_("entry '%s' in tree %s has tree mode, " + "but is not a tree"), + entry.path, oid_to_hex(&tree->object.oid)); + } t->object.flags |= NOT_USER_GIVEN; process_tree(ctx, t, base, entry.path); } -- cgit v1.2.3