diff options
Diffstat (limited to 'pack-check.c')
-rw-r--r-- | pack-check.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/pack-check.c b/pack-check.c index d04536bbff..3623c716e3 100644 --- a/pack-check.c +++ b/pack-check.c @@ -73,12 +73,11 @@ static int verify_packfile(struct packed_git *p, } -#define MAX_CHAIN 40 +#define MAX_CHAIN 50 static void show_pack_info(struct packed_git *p) { - uint32_t nr_objects, i, chain_histogram[MAX_CHAIN]; - + uint32_t nr_objects, i, chain_histogram[MAX_CHAIN+1]; nr_objects = p->num_objects; memset(chain_histogram, 0, sizeof(chain_histogram)); @@ -109,32 +108,37 @@ static void show_pack_info(struct packed_git *p) printf("%-6s %lu %"PRIuMAX" %u %s\n", type, size, (uintmax_t)offset, delta_chain_length, sha1_to_hex(base_sha1)); - if (delta_chain_length < MAX_CHAIN) + if (delta_chain_length <= MAX_CHAIN) chain_histogram[delta_chain_length]++; else chain_histogram[0]++; } } - for (i = 0; i < MAX_CHAIN; i++) { + for (i = 0; i <= MAX_CHAIN; i++) { if (!chain_histogram[i]) continue; - printf("chain length %s %d: %d object%s\n", - i ? "=" : ">=", - i ? i : MAX_CHAIN, - chain_histogram[i], - 1 < chain_histogram[i] ? "s" : ""); + printf("chain length = %d: %d object%s\n", i, + chain_histogram[i], chain_histogram[i] > 1 ? "s" : ""); } + if (chain_histogram[0]) + printf("chain length > %d: %d object%s\n", MAX_CHAIN, + chain_histogram[0], chain_histogram[0] > 1 ? "s" : ""); } int verify_pack(struct packed_git *p, int verbose) { - off_t index_size = p->index_size; - const unsigned char *index_base = p->index_data; + off_t index_size; + const unsigned char *index_base; SHA_CTX ctx; unsigned char sha1[20]; int ret; + if (open_pack_index(p)) + return error("packfile %s index not opened", p->pack_name); + index_size = p->index_size; + index_base = p->index_data; + ret = 0; /* Verify SHA1 sum of the index file */ SHA1_Init(&ctx); |