summaryrefslogtreecommitdiff
path: root/pack-check.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-11-07 02:59:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-11-07 04:31:28 (GMT)
commit473935188cc9b0363b30553f23d816231a66cb44 (patch)
tree3976b4db1243298c65cfb18785516b74612dcd87 /pack-check.c
parenta3ed7552d6c800b476a3bdfec5fa575295ea4bdf (diff)
downloadgit-473935188cc9b0363b30553f23d816231a66cb44.zip
git-473935188cc9b0363b30553f23d816231a66cb44.tar.gz
git-473935188cc9b0363b30553f23d816231a66cb44.tar.bz2
verify_packfile(): check as many object as possible in a pack
verify_packfile() checks for whole pack integerity first, then each object individually. Once we get past whole pack check, we can identify all objects in the pack. If there's an error with one object, we should continue to check the next objects to salvage as many objects as possible instead of stopping the process. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-check.c')
-rw-r--r--pack-check.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/pack-check.c b/pack-check.c
index 0c19b6e..7ac9b3a 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -113,18 +113,13 @@ static int verify_packfile(struct packed_git *p,
p->pack_name, (uintmax_t)offset);
}
data = unpack_entry(p, entries[i].offset, &type, &size);
- if (!data) {
+ if (!data)
err = error("cannot unpack %s from %s at offset %"PRIuMAX"",
sha1_to_hex(entries[i].sha1), p->pack_name,
(uintmax_t)entries[i].offset);
- break;
- }
- if (check_sha1_signature(entries[i].sha1, data, size, typename(type))) {
+ else if (check_sha1_signature(entries[i].sha1, data, size, typename(type)))
err = error("packed %s from %s is corrupt",
sha1_to_hex(entries[i].sha1), p->pack_name);
- free(data);
- break;
- }
free(data);
}
free(entries);