{"thread":{"id":"8319","subject":"[PATCH] fixes to output of git-verify-pack -v","startedAt":"2007-05-26T03:37:40Z","lastAt":"2007-05-26T03:37:40Z","messageCount":1,"participants":["Nicolas Pitre"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"43320","messageId":"alpine.LFD.0.99.0705252331130.3366@xanadu.home","threadId":"8319","inReplyTo":null,"subject":"[PATCH] fixes to output of git-verify-pack -v","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-05-26T03:37:40Z","receivedAt":"2007-05-26T03:37:40Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"Now that the default delta depth is 50, it is a good idea to also bump \nMAX_CHAIN to 50.\n\nWhile at it, make the display a bit prettier by making the MAX_CHAIN \nlimit inclusive, and display the number of deltas that are above that \nlimit at the end instead of the beginning.\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n---\n\ndiff --git a/pack-check.c b/pack-check.c\nindex d04536b..c168642 100644\n--- a/pack-check.c\n+++ b/pack-check.c\n@@ -73,12 +73,11 @@ static int verify_packfile(struct packed_git *p,\n }\n \n \n-#define MAX_CHAIN 40\n+#define MAX_CHAIN 50\n \n static void show_pack_info(struct packed_git *p)\n {\n-\tuint32_t nr_objects, i, chain_histogram[MAX_CHAIN];\n-\n+\tuint32_t nr_objects, i, chain_histogram[MAX_CHAIN+1];\n \tnr_objects = p->num_objects;\n \tmemset(chain_histogram, 0, sizeof(chain_histogram));\n \n@@ -109,22 +108,22 @@ static void show_pack_info(struct packed_git *p)\n \t\t\tprintf(\"%-6s %lu %\"PRIuMAX\" %u %s\\n\",\n \t\t\t       type, size, (uintmax_t)offset,\n \t\t\t       delta_chain_length, sha1_to_hex(base_sha1));\n-\t\t\tif (delta_chain_length < MAX_CHAIN)\n+\t\t\tif (delta_chain_length <= MAX_CHAIN)\n \t\t\t\tchain_histogram[delta_chain_length]++;\n \t\t\telse\n \t\t\t\tchain_histogram[0]++;\n \t\t}\n \t}\n \n-\tfor (i = 0; i < MAX_CHAIN; i++) {\n+\tfor (i = 0; i <= MAX_CHAIN; i++) {\n \t\tif (!chain_histogram[i])\n \t\t\tcontinue;\n-\t\tprintf(\"chain length %s %d: %d object%s\\n\",\n-\t\t       i ? \"=\" : \">=\",\n-\t\t       i ? i : MAX_CHAIN,\n-\t\t       chain_histogram[i],\n-\t\t       1 < chain_histogram[i] ? \"s\" : \"\");\n+\t\tprintf(\"chain length = %d: %d object%s\\n\", i,\n+\t\t       chain_histogram[i], chain_histogram[i] > 1 ? \"s\" : \"\");\n \t}\n+\tif (chain_histogram[0])\n+\t\tprintf(\"chain length > %d: %d object%s\\n\", MAX_CHAIN,\n+\t\t       chain_histogram[0], chain_histogram[0] > 1 ? \"s\" : \"\");\n }\n \n int verify_pack(struct packed_git *p, int verbose)\n"}]}