]> granicus.if.org Git - git/commitdiff
pack-bitmap: don't rely on bitmap_git->reuse_objects
authorJeff King <peff@peff.net>
Fri, 13 Sep 2019 13:02:21 +0000 (15:02 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 Sep 2019 21:40:33 +0000 (14:40 -0700)
As we now allocate 2 more words than necessary for each
bitmap to serve as marks telling us that we can stop
iterating over the words, we don't need to rely on
bitmap_git->reuse_objects to stop iterating over the words.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack-bitmap.c

index ed2befaac6535f25602fca57374d27d058277426..b2422fed8feca443d4b20436f78df6e26632d04a 100644 (file)
@@ -622,7 +622,7 @@ static void show_objects_for_type(
        enum object_type object_type,
        show_reachable_fn show_reach)
 {
-       size_t pos = 0, i = 0;
+       size_t i = 0;
        uint32_t offset;
 
        struct ewah_iterator it;
@@ -630,13 +630,15 @@ static void show_objects_for_type(
 
        struct bitmap *objects = bitmap_git->result;
 
-       if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects)
-               return;
-
        ewah_iterator_init(&it, type_filter);
 
-       while (i < objects->word_alloc && ewah_iterator_next(&filter, &it)) {
+       for (i = 0; i < objects->word_alloc &&
+                       ewah_iterator_next(&filter, &it); i++) {
                eword_t word = objects->words[i] & filter;
+               size_t pos = (i * BITS_IN_EWORD);
+
+               if (!word)
+                       continue;
 
                for (offset = 0; offset < BITS_IN_EWORD; ++offset) {
                        struct object_id oid;
@@ -648,9 +650,6 @@ static void show_objects_for_type(
 
                        offset += ewah_bit_ctz64(word >> offset);
 
-                       if (pos + offset < bitmap_git->reuse_objects)
-                               continue;
-
                        entry = &bitmap_git->pack->revindex[pos + offset];
                        nth_packed_object_oid(&oid, bitmap_git->pack, entry->nr);
 
@@ -659,9 +658,6 @@ static void show_objects_for_type(
 
                        show_reach(&oid, object_type, 0, hash, bitmap_git->pack, entry->offset);
                }
-
-               pos += BITS_IN_EWORD;
-               i++;
        }
 }