MCPcopy Create free account
hub / github.com/git/git / check_pack_crc

Function check_pack_crc

pack-check.c:30–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30int check_pack_crc(struct packed_git *p, struct pack_window **w_curs,
31 off_t offset, off_t len, unsigned int nr)
32{
33 const uint32_t *index_crc;
34 uint32_t data_crc = crc32(0, NULL, 0);
35
36 do {
37 unsigned long avail;
38 void *data = use_pack(p, w_curs, offset, &avail);
39 if (avail > len)
40 avail = len;
41 data_crc = crc32(data_crc, data, avail);
42 offset += avail;
43 len -= avail;
44 } while (len);
45
46 index_crc = p->index_data;
47 index_crc += 2 + 256 + (size_t)p->num_objects * (p->repo->hash_algo->rawsz/4) + nr;
48
49 return data_crc != ntohl(*index_crc);
50}
51
52static int verify_packfile(struct repository *r,
53 struct packed_git *p,

Callers 3

verify_packfileFunction · 0.85
unpack_entryFunction · 0.85
write_reuse_objectFunction · 0.85

Calls 1

use_packFunction · 0.85

Tested by

no test coverage detected