Subject: [PATCH 03/11] pack-objects --count-only

From: Junio C Hamano <[email-masked]>
Date: Thu, 11 Aug 2011 10:53:08 -0700

This is merely to help debugging the bottleneck of "Counting objects"
phase of the pack-objects process.  Use it like this:

git pack-objects --count-only --keep-true-parents --honor-pack-keep \
	--non-empty --all --reflog --no-reuse-delta \
	--delta-base-offset --stdout </dev/null >/dev/null

Signed-off-by: Junio C Hamano <[email-masked]>
---
 builtin/pack-objects.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index f402a84..6a208a9 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2121,6 +2121,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 	int use_internal_rev_list = 0;
 	int thin = 0;
 	int all_progress_implied = 0;
+	int count_only = 0;
 	uint32_t i;
 	const char **rp_av;
 	int rp_ac_alloc = 64;
@@ -2291,6 +2292,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 			grafts_replace_parents = 0;
 			continue;
 		}
+		if (!strcmp("--count-only", arg)) {
+			count_only = 1;
+			continue;
+		}
 		usage(pack_usage);
 	}
 
@@ -2348,6 +2353,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 
 	if (non_empty && !nr_result)
 		return 0;
+	if (count_only)
+		return 0;
 	if (nr_result)
 		prepare_pack(window, depth);
 	write_pack_file();
-- 
1.7.6.433.g1421f