@matheusbsbs / matheus-bagliano / commits / d2ea031046
Fork 0

pack-bitmap: don't rely on bitmap_git->reuse_objects

We no longer compute bitmap_git->reuse_objects, so we cannot rely on it anymore to terminate the loop early; we have to iterate to the end. 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>

Jeff King committed Dec 18, 2019 at 12:25 UTC d2ea031046e8b10c2fd8120996db2dd542b30764
1 file changed +7 -11
pack-bitmap.c
+7 -11
@@ -629,7 +629,7 @@ static void show_objects_for_type(
629 enum object_type object_type,
630 show_reachable_fn show_reach)
631 {
632 - size_t pos = 0, i = 0;
632 + size_t i = 0;
633 uint32_t offset;
634
635 struct ewah_iterator it;
@@ -637,13 +637,15 @@ static void show_objects_for_type(
637
638 struct bitmap *objects = bitmap_git->result;
639
640 - if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects)
641 - return;
642 -
640 ewah_iterator_init(&it, type_filter);
641
645 - while (i < objects->word_alloc && ewah_iterator_next(&filter, &it)) {
642 + for (i = 0; i < objects->word_alloc &&
643 + ewah_iterator_next(&filter, &it); i++) {
644 eword_t word = objects->words[i] & filter;
645 + size_t pos = (i * BITS_IN_EWORD);
646 +
647 + if (!word)
648 + continue;
649
650 for (offset = 0; offset < BITS_IN_EWORD; ++offset) {
651 struct object_id oid;
@@ -655,9 +657,6 @@ static void show_objects_for_type(
657
658 offset += ewah_bit_ctz64(word >> offset);
659
658 - if (pos + offset < bitmap_git->reuse_objects)
659 - continue;
660 -
660 entry = &bitmap_git->pack->revindex[pos + offset];
661 nth_packed_object_oid(&oid, bitmap_git->pack, entry->nr);
662
@@ -666,9 +665,6 @@ static void show_objects_for_type(
665
666 show_reach(&oid, object_type, 0, hash, bitmap_git->pack, entry->offset);
667 }
669 -
670 - pos += BITS_IN_EWORD;
671 - i++;
668 }
669 }
670