fixes to output of git-verify-pack -v
Now that the default delta depth is 50, it is a good idea to also bump MAX_CHAIN to 50. While at it, make the display a bit prettier by making the MAX_CHAIN limit inclusive, and display the number of deltas that are above that limit at the end instead of the beginning. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Nicolas Pitre committed
May 25, 2007 at 23:37 UTC
ddcf786fd7d5755711439371dcfd9a7ba1dfa7a5
1 file changed
+9
-10
pack-check.c
+9
-10
@@ -73,12 +73,11 @@ static int verify_packfile(struct packed_git *p,
73
}
74
75
76
-#define MAX_CHAIN 40
76
+#define MAX_CHAIN 50
77
78
static void show_pack_info(struct packed_git *p)
79
{
80
- uint32_t nr_objects, i, chain_histogram[MAX_CHAIN];
81
-
80
+ uint32_t nr_objects, i, chain_histogram[MAX_CHAIN+1];
81
nr_objects = p->num_objects;
82
memset(chain_histogram, 0, sizeof(chain_histogram));
83
@@ -109,22 +108,22 @@ static void show_pack_info(struct packed_git *p)
108
printf("%-6s %lu %"PRIuMAX" %u %s\n",
109
type, size, (uintmax_t)offset,
110
delta_chain_length, sha1_to_hex(base_sha1));
112
- if (delta_chain_length < MAX_CHAIN)
111
+ if (delta_chain_length <= MAX_CHAIN)
112
chain_histogram[delta_chain_length]++;
113
else
114
chain_histogram[0]++;
115
}
116
}
117
119
- for (i = 0; i < MAX_CHAIN; i++) {
118
+ for (i = 0; i <= MAX_CHAIN; i++) {
119
if (!chain_histogram[i])
120
continue;
122
- printf("chain length %s %d: %d object%s\n",
123
- i ? "=" : ">=",
124
- i ? i : MAX_CHAIN,
125
- chain_histogram[i],
126
- 1 < chain_histogram[i] ? "s" : "");
121
+ printf("chain length = %d: %d object%s\n", i,
122
+ chain_histogram[i], chain_histogram[i] > 1 ? "s" : "");
123
}
124
+ if (chain_histogram[0])
125
+ printf("chain length > %d: %d object%s\n", MAX_CHAIN,
126
+ chain_histogram[0], chain_histogram[0] > 1 ? "s" : "");
127
}
128
129
int verify_pack(struct packed_git *p, int verbose)