зеркало из https://github.com/microsoft/git.git
get_delta_base_oid(): convert to new revindex API
Replace direct accesses to the 'struct revindex' type with a call to 'pack_pos_to_index()'. Likewise drop the old-style 'find_pack_revindex()' with its replacement 'offset_to_pack_pos()' (while continuing to perform the same error checking). Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
78232bf65d
Коммит
45bef5c064
|
@ -1235,18 +1235,18 @@ static int get_delta_base_oid(struct packed_git *p,
|
||||||
oidread(oid, base);
|
oidread(oid, base);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (type == OBJ_OFS_DELTA) {
|
} else if (type == OBJ_OFS_DELTA) {
|
||||||
struct revindex_entry *revidx;
|
uint32_t base_pos;
|
||||||
off_t base_offset = get_delta_base(p, w_curs, &curpos,
|
off_t base_offset = get_delta_base(p, w_curs, &curpos,
|
||||||
type, delta_obj_offset);
|
type, delta_obj_offset);
|
||||||
|
|
||||||
if (!base_offset)
|
if (!base_offset)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
revidx = find_pack_revindex(p, base_offset);
|
if (offset_to_pack_pos(p, base_offset, &base_pos) < 0)
|
||||||
if (!revidx)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return nth_packed_object_id(oid, p, revidx->nr);
|
return nth_packed_object_id(oid, p,
|
||||||
|
pack_pos_to_index(p, base_pos));
|
||||||
} else
|
} else
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче