X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=object.c;h=1fdebe012ba8a6db0b6eae443e40a7f74ae2d597;hb=6d0de319d6249096fe934317e937177d07b1b84f;hp=63e6e784d41ef5aa7bb387a96a85bf0f8e7248ab;hpb=680bab3d9a33029be38590681832ae9b6d74ad60;p=git.git diff --git a/object.c b/object.c index 63e6e784..1fdebe01 100644 --- a/object.c +++ b/object.c @@ -9,6 +9,8 @@ struct object **objs; int nr_objs; static int obj_allocs; +int track_object_refs = 1; + static int find_object(const unsigned char *sha1) { int first = 0, last = nr_objs; @@ -67,9 +69,12 @@ void created_object(const unsigned char *sha1, struct object *obj) void add_ref(struct object *refer, struct object *target) { - struct object_list **pp = &refer->refs; - struct object_list *p; - + struct object_list **pp, *p; + + if (!track_object_refs) + return; + + pp = &refer->refs; while ((p = *pp) != NULL) { if (p->item == target) return; @@ -87,6 +92,8 @@ void mark_reachable(struct object *obj, unsigned int mask) { struct object_list *p = obj->refs; + if (!track_object_refs) + die("cannot do reachability with object refs turned off"); /* If we've been here already, don't bother */ if (obj->flags & mask) return;