summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-01-27 23:19:30 -0800
committerJunio C Hamano <gitster@pobox.com>2009-01-28 11:00:28 -0800
commitaeeae1b771020f1ac6692f89563e3f8689c704e7 (patch)
tree8c8895b475b98da4a88659afeec5c64ded8c4c44 /revision.c
parent02322e1619dc537dc48650761f6c9bae883612a7 (diff)
downloadgit-aeeae1b771020f1ac6692f89563e3f8689c704e7.tar.gz
revision traversal: allow UNINTERESTING objects to be missing
Most of the existing codepaths were meant to treat missing uninteresting objects to be a silently ignored non-error, but there were a few places in handle_commit() and add_parents_to_list(), which are two key functions in the revision traversal machinery, that cared: - When a tag refers to an object that we do not have, we barfed. We ignore such a tag if it is painted as UNINTERESTING with this change. - When digging deeper into the ancestry chain of a commit that is already painted as UNINTERESTING, in order to paint its parents UNINTERESTING, we barfed if parse_parent() for a parent commit object failed. We can ignore such a parent commit object. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/revision.c b/revision.c
index db60f06c98..1663ac80ea 100644
--- a/revision.c
+++ b/revision.c
@@ -183,8 +183,11 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
if (!tag->tagged)
die("bad tag");
object = parse_object(tag->tagged->sha1);
- if (!object)
+ if (!object) {
+ if (flags & UNINTERESTING)
+ return NULL;
die("bad object %s", sha1_to_hex(tag->tagged->sha1));
+ }
}
/*
@@ -479,9 +482,10 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit,
while (parent) {
struct commit *p = parent->item;
parent = parent->next;
+ if (p)
+ p->object.flags |= UNINTERESTING;
if (parse_commit(p) < 0)
- return -1;
- p->object.flags |= UNINTERESTING;
+ continue;
if (p->parents)
mark_parents_uninteresting(p);
if (p->object.flags & SEEN)