summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2019-12-18 12:25:47 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-01-23 10:51:50 -0800
commitd2ea031046e8b10c2fd8120996db2dd542b30764 (patch)
tree007480faae11ba668f4ea1a4d51e2acb079b0b12
parentpack-objects: add checks for duplicate objects (diff)
downloadtgif-d2ea031046e8b10c2fd8120996db2dd542b30764.tar.xz
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>
-rw-r--r--pack-bitmap.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/pack-bitmap.c b/pack-bitmap.c
index 9254a7c98a..b6315e5b33 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -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++;
}
}