summary refs log tree commit diff
path: root/list-objects.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2019-04-09 19:13:19 -0700
committerJunio C Hamano <gitster@pobox.com>2019-04-10 12:59:39 +0900
commitb49e74eac480d167c3af8f1286fe520c3d7ce9e1 (patch)
treeae973ee4c011fb9e7d82c86c2e809b735272d9bf /list-objects.c
parent23c204455bf2198806e8c7b0cd86b20a50a379d0 (diff)
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 <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'list-objects.c')
-rw-r--r--list-objects.c5
1 files changed, 5 insertions, 0 deletions
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);
 		}