return index->pack->num_objects;
}
+static uint32_t bitmap_name_hash(struct bitmap_index *index, uint32_t pos)
+{
+ if (bitmap_is_midx(index)) {
+ while (index && pos < index->midx->num_objects_in_base) {
+ ASSERT(bitmap_is_midx(index));
+ index = index->base;
+ }
+
+ if (!index)
+ BUG("NULL base bitmap for object position: %"PRIu32, pos);
+
+ pos -= index->midx->num_objects_in_base;
+ if (pos >= index->midx->num_objects)
+ BUG("out-of-bounds midx bitmap object at %"PRIu32, pos);
+ }
+
+ if (!index->hashes)
+ return 0;
+
+ return get_be32(index->hashes + pos);
+}
+
static struct repository *bitmap_repo(struct bitmap_index *bitmap_git)
{
if (bitmap_is_midx(bitmap_git))
pack = bitmap_git->pack;
}
- if (bitmap_git->hashes)
- hash = get_be32(bitmap_git->hashes + index_pos);
+ hash = bitmap_name_hash(bitmap_git, index_pos);
show_reach(&oid, object_type, 0, hash, pack, ofs, payload);
}
if (oe) {
reposition[i] = oe_in_pack_pos(mapping, oe) + 1;
- if (bitmap_git->hashes && !oe->hash)
- oe->hash = get_be32(bitmap_git->hashes + index_pos);
+ if (!oe->hash)
+ oe->hash = bitmap_name_hash(bitmap_git, index_pos);
}
}