MCPcopy Index your code
hub / github.com/git/git / nth_packed_object_id

Function nth_packed_object_id

packfile.c:2026–2048  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2024}
2025
2026int nth_packed_object_id(struct object_id *oid,
2027 struct packed_git *p,
2028 uint32_t n)
2029{
2030 const unsigned char *index = p->index_data;
2031 const unsigned int hashsz = p->repo->hash_algo->rawsz;
2032 if (!index) {
2033 if (open_pack_index(p))
2034 return -1;
2035 index = p->index_data;
2036 }
2037 if (n >= p->num_objects)
2038 return -1;
2039 index += 4 * 256;
2040 if (p->index_version == 1) {
2041 oidread(oid, index + st_add(st_mult(hashsz + 4, n), 4),
2042 p->repo->hash_algo);
2043 } else {
2044 index += 8;
2045 oidread(oid, index + st_mult(hashsz, n), p->repo->hash_algo);
2046 }
2047 return 0;
2048}
2049
2050void check_pack_index_ptr(const struct packed_git *p, const void *vptr)
2051{

Callers 13

nth_bitmap_object_oidFunction · 0.85
verify_packfileFunction · 0.85
get_delta_base_oidFunction · 0.85
retry_bad_packed_offsetFunction · 0.85
unpack_entryFunction · 0.85
for_each_object_in_packFunction · 0.85
find_abbrev_len_for_packFunction · 0.85
fill_pack_entryFunction · 0.85
dump_mtimesFunction · 0.85
write_reused_pack_oneFunction · 0.85
check_objectFunction · 0.85

Calls 4

open_pack_indexFunction · 0.85
oidreadFunction · 0.85
st_addFunction · 0.85
st_multFunction · 0.85

Tested by 1

dump_mtimesFunction · 0.68