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

Function nth_packed_object_offset

packfile.c:2064–2082  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2062}
2063
2064off_t nth_packed_object_offset(const struct packed_git *p, uint32_t n)
2065{
2066 const unsigned char *index = p->index_data;
2067 const unsigned int hashsz = p->repo->hash_algo->rawsz;
2068 index += 4 * 256;
2069 if (p->index_version == 1) {
2070 return ntohl(*((uint32_t *)(index + st_mult(hashsz + 4, n))));
2071 } else {
2072 uint32_t off;
2073 index += st_add(8, st_mult(p->num_objects, hashsz + 4));
2074 off = ntohl(*((uint32_t *)(index + st_mult(4, n))));
2075 if (!(off & 0x80000000))
2076 return off;
2077 index += st_add(st_mult(p->num_objects, 4),
2078 st_mult(off & 0x7fffffff, 8));
2079 check_pack_index_ptr(p, index);
2080 return get_be64(index);
2081 }
2082}
2083
2084off_t find_pack_entry_one(const struct object_id *oid,
2085 struct packed_git *p)

Callers 9

verify_packfileFunction · 0.85
add_packed_commitsFunction · 0.85
find_pack_entry_oneFunction · 0.85
fill_pack_entryFunction · 0.85
pack_pos_to_offsetFunction · 0.85
add_packed_objectFunction · 0.85
batch_one_object_packedFunction · 0.85

Calls 4

st_multFunction · 0.85
st_addFunction · 0.85
check_pack_index_ptrFunction · 0.85
get_be64Function · 0.85

Tested by 1

add_packed_objectFunction · 0.68