get_size_by_pos(): convert to new revindex API

Remove another caller that holds onto a 'struct revindex_entry' by replacing the direct indexing with calls to 'pack_pos_to_offset()' and 'pack_pos_to_index()'. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Taylor Blau committed Jan 13, 2021 at 17:24 UTC a78a90324d1c5ccba2ab46cb70573518dd6eeade
1 file changed +4 -4
pack-bitmap.c
+4 -4
@@ -835,11 +835,11 @@ static unsigned long get_size_by_pos(struct bitmap_index *bitmap_git,
835 oi.sizep = &size;
836
837 if (pos < pack->num_objects) {
838 - struct revindex_entry *entry = &pack->revindex[pos];
839 - if (packed_object_info(the_repository, pack,
840 - entry->offset, &oi) < 0) {
838 + off_t ofs = pack_pos_to_offset(pack, pos);
839 + if (packed_object_info(the_repository, pack, ofs, &oi) < 0) {
840 struct object_id oid;
842 - nth_packed_object_id(&oid, pack, entry->nr);
841 + nth_packed_object_id(&oid, pack,
842 + pack_pos_to_index(pack, pos));
843 die(_("unable to get size of %s"), oid_to_hex(&oid));
844 }
845 } else {