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>
This commit is contained in:
Jeff King 2019-12-18 12:25:47 +01:00 коммит произвёл Junio C Hamano
Родитель 92fb0db94c
Коммит d2ea031046
1 изменённых файлов: 7 добавлений и 11 удалений

Просмотреть файл

@ -629,7 +629,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;
@ -637,13 +637,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;
@ -655,9 +657,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);
@ -666,9 +665,6 @@ static void show_objects_for_type(
show_reach(&oid, object_type, 0, hash, bitmap_git->pack, entry->offset);
}
pos += BITS_IN_EWORD;
i++;
}
}