summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5981e09)
raw | patch | inline | side by side (parent: 5981e09)
author | Junio C Hamano <junkio@cox.net> | |
Thu, 27 Apr 2006 22:42:01 +0000 (15:42 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 27 Apr 2006 22:42:17 +0000 (15:42 -0700) |
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>
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>
pack-check.c | patch | blob | history |
diff --git a/pack-check.c b/pack-check.c
index 84ed90d36912fc4ad6589cd2792e85a470418d04..e57587909e54d9317a18e3bfd43559562a40f0d5 100644 (file)
--- a/pack-check.c
+++ b/pack-check.c
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,