retry_bad_packed_offset(): convert to new revindex API

Perform exactly the same conversion as in the previous commit to another
caller within 'packfile.c'.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Taylor Blau 2021-01-13 17:24:36 -05:00 committed by Junio C Hamano
parent 45bef5c064
commit 3a3f54dd0a

View File

@ -1256,12 +1256,11 @@ static int retry_bad_packed_offset(struct repository *r,
off_t obj_offset) off_t obj_offset)
{ {
int type; int type;
struct revindex_entry *revidx; uint32_t pos;
struct object_id oid; struct object_id oid;
revidx = find_pack_revindex(p, obj_offset); if (offset_to_pack_pos(p, obj_offset, &pos) < 0)
if (!revidx)
return OBJ_BAD; return OBJ_BAD;
nth_packed_object_id(&oid, p, revidx->nr); nth_packed_object_id(&oid, p, pack_pos_to_index(p, pos));
mark_bad_packed_object(p, oid.hash); mark_bad_packed_object(p, oid.hash);
type = oid_object_info(r, &oid, NULL); type = oid_object_info(r, &oid, NULL);
if (type <= OBJ_NONE) if (type <= OBJ_NONE)