]> git.ipfire.org Git - thirdparty/git.git/commitdiff
get_size_by_pos(): convert to new revindex API
authorTaylor Blau <me@ttaylorr.com>
Wed, 13 Jan 2021 22:24:00 +0000 (17:24 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Jan 2021 05:53:46 +0000 (21:53 -0800)
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>
pack-bitmap.c

index 27a7a8ac4cc66e6c9f178dbbe1869af93dcfec4c..89a528a91b19daaa312a5b5e32e4b54aa6a286fe 100644 (file)
@@ -835,11 +835,11 @@ static unsigned long get_size_by_pos(struct bitmap_index *bitmap_git,
        oi.sizep = &size;
 
        if (pos < pack->num_objects) {
-               struct revindex_entry *entry = &pack->revindex[pos];
-               if (packed_object_info(the_repository, pack,
-                                      entry->offset, &oi) < 0) {
+               off_t ofs = pack_pos_to_offset(pack, pos);
+               if (packed_object_info(the_repository, pack, ofs, &oi) < 0) {
                        struct object_id oid;
-                       nth_packed_object_id(&oid, pack, entry->nr);
+                       nth_packed_object_id(&oid, pack,
+                                            pack_pos_to_index(pack, pos));
                        die(_("unable to get size of %s"), oid_to_hex(&oid));
                }
        } else {