From: Junio C Hamano Date: Thu, 27 Apr 2006 22:42:01 +0000 (-0700) Subject: verify-pack: check integrity in a saner order. X-Git-Tag: v1.3.2~14 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=55e1805dffeb5d2a8ccd717b2d07ca8887436a69;p=git.git verify-pack: check integrity in a saner order. Check internal integrity to report corrupt pack or idx, and then check cross-integrity between idx and pack. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- diff --git a/pack-check.c b/pack-check.c index 84ed90d36..e57587909 100644 --- a/pack-check.c +++ b/pack-check.c @@ -29,12 +29,12 @@ static int verify_packfile(struct packed_git *p) pack_base = p->pack_base; SHA1_Update(&ctx, pack_base, pack_size - 20); SHA1_Final(sha1, &ctx); - if (memcmp(sha1, index_base + index_size - 40, 20)) - return error("Packfile %s SHA1 mismatch with idx", - p->pack_name); if (memcmp(sha1, pack_base + pack_size - 20, 20)) return error("Packfile %s SHA1 mismatch with itself", p->pack_name); + if (memcmp(sha1, index_base + index_size - 40, 20)) + return error("Packfile %s SHA1 mismatch with idx", + p->pack_name); /* Make sure everything reachable from idx is valid. Since we * have verified that nr_objects matches between idx and pack,