diff options
author | Nicolas Pitre <nico@cam.org> | 2008-06-24 23:19:02 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-06-24 23:58:57 -0700 |
commit | c41a4a9468b0c728e77ec5d97da7bfb63776ac3f (patch) | |
tree | 6f17dc7359d8edae4043aa06a50eb88cba8d4304 /builtin-pack-objects.c | |
parent | move show_pack_info() where it belongs (diff) | |
download | tgif-c41a4a9468b0c728e77ec5d97da7bfb63776ac3f.tar.xz |
verify-pack: check packed object CRC when using index version 2
To do so, check_pack_crc() moved from builtin-pack-objects.c to
pack-check.c where it is more logical to share.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r-- | builtin-pack-objects.c | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 827673ce4e..28207d9b3a 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -209,28 +209,6 @@ static int check_pack_inflate(struct packed_git *p, stream.total_in == len) ? 0 : -1; } -static int check_pack_crc(struct packed_git *p, struct pack_window **w_curs, - off_t offset, off_t len, unsigned int nr) -{ - const uint32_t *index_crc; - uint32_t data_crc = crc32(0, Z_NULL, 0); - - do { - unsigned int avail; - void *data = use_pack(p, w_curs, offset, &avail); - if (avail > len) - avail = len; - data_crc = crc32(data_crc, data, avail); - offset += avail; - len -= avail; - } while (len); - - index_crc = p->index_data; - index_crc += 2 + 256 + p->num_objects * (20/4) + nr; - - return data_crc != ntohl(*index_crc); -} - static void copy_pack_data(struct sha1file *f, struct packed_git *p, struct pack_window **w_curs, |