summaryrefslogtreecommitdiffstats
path: root/list-objects.c
diff options
context:
space:
mode:
authorMatthew DeVore <matvore@google.com>2018-10-05 14:31:23 -0700
committerJunio C Hamano <gitster@pobox.com>2018-10-07 08:55:00 +0900
commit7c0fe330d5f3d2fc7aac57a19c7580ea2543c799 (patch)
tree715ad64110c66efc978120aaab51c5a875dc4911 /list-objects.c
parentf1d02daacfe657fd175634174b4928a645d537f4 (diff)
downloadgit-7c0fe330d5f3d2fc7aac57a19c7580ea2543c799.tar.gz
git-7c0fe330d5f3d2fc7aac57a19c7580ea2543c799.tar.xz
rev-list: handle missing tree objects properly
Previously, we assumed only blob objects could be missing. This patch makes rev-list handle missing trees like missing blobs. The --missing=* and --exclude-promisor-objects flags now work for trees as they already do for blobs. This is demonstrated in t6112. Signed-off-by: Matthew DeVore <matvore@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'list-objects.c')
-rw-r--r--list-objects.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/list-objects.c b/list-objects.c
index f9b51db7a..243192af5 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -143,6 +143,7 @@ static void process_tree(struct traversal_context *ctx,
struct rev_info *revs = ctx->revs;
int baselen = base->len;
enum list_objects_filter_result r = LOFR_MARK_SEEN | LOFR_DO_SHOW;
+ int failed_parse;
if (!revs->tree_objects)
return;
@@ -150,7 +151,9 @@ static void process_tree(struct traversal_context *ctx,
die("bad tree object");
if (obj->flags & (UNINTERESTING | SEEN))
return;
- if (parse_tree_gently(tree, 1) < 0) {
+
+ failed_parse = parse_tree_gently(tree, 1);
+ if (failed_parse) {
if (revs->ignore_missing_links)
return;
@@ -163,7 +166,8 @@ static void process_tree(struct traversal_context *ctx,
is_promisor_object(&obj->oid))
return;
- die("bad tree object %s", oid_to_hex(&obj->oid));
+ if (!revs->do_not_die_on_missing_tree)
+ die("bad tree object %s", oid_to_hex(&obj->oid));
}
strbuf_addstr(base, name);
@@ -178,7 +182,8 @@ static void process_tree(struct traversal_context *ctx,
if (base->len)
strbuf_addch(base, '/');
- process_tree_contents(ctx, tree, base);
+ if (!failed_parse)
+ process_tree_contents(ctx, tree, base);
if (!(obj->flags & USER_GIVEN) && ctx->filter_fn) {
r = ctx->filter_fn(LOFS_END_TREE, obj,