Skip to content

Commit ddcf786

Browse files
Nicolas PitreJunio C Hamano
authored andcommitted
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>
1 parent 18bece4 commit ddcf786

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

pack-check.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,11 @@ static int verify_packfile(struct packed_git *p,
7373
}
7474

7575

76-
#define MAX_CHAIN 40
76+
#define MAX_CHAIN 50
7777

7878
static void show_pack_info(struct packed_git *p)
7979
{
80-
uint32_t nr_objects, i, chain_histogram[MAX_CHAIN];
81-
80+
uint32_t nr_objects, i, chain_histogram[MAX_CHAIN+1];
8281
nr_objects = p->num_objects;
8382
memset(chain_histogram, 0, sizeof(chain_histogram));
8483

@@ -109,22 +108,22 @@ static void show_pack_info(struct packed_git *p)
109108
printf("%-6s %lu %"PRIuMAX" %u %s\n",
110109
type, size, (uintmax_t)offset,
111110
delta_chain_length, sha1_to_hex(base_sha1));
112-
if (delta_chain_length < MAX_CHAIN)
111+
if (delta_chain_length <= MAX_CHAIN)
113112
chain_histogram[delta_chain_length]++;
114113
else
115114
chain_histogram[0]++;
116115
}
117116
}
118117

119-
for (i = 0; i < MAX_CHAIN; i++) {
118+
for (i = 0; i <= MAX_CHAIN; i++) {
120119
if (!chain_histogram[i])
121120
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" : "");
127123
}
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" : "");
128127
}
129128

130129
int verify_pack(struct packed_git *p, int verbose)

0 commit comments

Comments
 (0)