diff options
author | Taylor Blau <me@ttaylorr.com> | 2021-01-13 17:23:39 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-13 21:53:45 -0800 |
commit | 66cbd3e2fbb552aa7dc51a805fbbb9174abc5ccb (patch) | |
tree | ced3b192a2ca2837204783414ec07a341c2e37e7 /builtin/pack-objects.c | |
parent | write_reuse_object(): convert to new revindex API (diff) | |
download | tgif-66cbd3e2fbb552aa7dc51a805fbbb9174abc5ccb.tar.xz |
write_reused_pack_one(): convert to new revindex API
Replace direct revindex accesses 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>
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r-- | builtin/pack-objects.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index ab1fd853f1..8e40b19ee8 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -868,8 +868,8 @@ static void write_reused_pack_one(size_t pos, struct hashfile *out, enum object_type type; unsigned long size; - offset = reuse_packfile->revindex[pos].offset; - next = reuse_packfile->revindex[pos + 1].offset; + offset = pack_pos_to_offset(reuse_packfile, pos); + next = pack_pos_to_offset(reuse_packfile, pos + 1); record_reused_object(offset, offset - hashfile_total(out)); @@ -889,11 +889,17 @@ static void write_reused_pack_one(size_t pos, struct hashfile *out, /* Convert to REF_DELTA if we must... */ if (!allow_ofs_delta) { - int base_pos = find_revindex_position(reuse_packfile, base_offset); + uint32_t base_pos; struct object_id base_oid; + if (offset_to_pack_pos(reuse_packfile, base_offset, &base_pos) < 0) + die(_("expected object at offset %"PRIuMAX" " + "in pack %s"), + (uintmax_t)base_offset, + reuse_packfile->pack_name); + nth_packed_object_id(&base_oid, reuse_packfile, - reuse_packfile->revindex[base_pos].nr); + pack_pos_to_index(reuse_packfile, base_pos)); len = encode_in_pack_object_header(header, sizeof(header), OBJ_REF_DELTA, size); |