summaryrefslogtreecommitdiff
path: root/pack-check.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-04-27 15:42:01 -0700
committerJunio C Hamano <junkio@cox.net>2006-04-27 15:42:17 -0700
commit55e1805dffeb5d2a8ccd717b2d07ca8887436a69 (patch)
tree9e969600edcc30c54db9d7d561b457f3d47e7c88 /pack-check.c
parent5981e09999e90b389a02843671529a0faaf72143 (diff)
downloadgit-55e1805dffeb5d2a8ccd717b2d07ca8887436a69.tar.gz
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 <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'pack-check.c')
-rw-r--r--pack-check.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pack-check.c b/pack-check.c
index 84ed90d369..e57587909e 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,