git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nico@cam.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH] fixes to output of git-verify-pack -v
Date: Fri, 25 May 2007 23:37:40 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.0.99.0705252331130.3366@xanadu.home> (raw)

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>
---

diff --git a/pack-check.c b/pack-check.c
index d04536b..c168642 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,22 +108,22 @@ 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)

                 reply	other threads:[~2007-05-26  3:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.0.99.0705252331130.3366@xanadu.home \
    --to=nico@cam.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).