summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 38a4556)
raw | patch | inline | side by side (parent: 38a4556)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 3 Jun 2011 22:32:16 +0000 (15:32 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 6 Jun 2011 05:45:37 +0000 (22:45 -0700) |
The histogram produced by "verify-pack -v" always had an artificial
limit of 50, but index-pack knows what the maximum delta depth is, so
we do not have to limit it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
limit of 50, but index-pack knows what the maximum delta depth is, so
we do not have to limit it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/index-pack.c | patch | blob | history |
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index aa3c9c6e11d97a6ca0608124d779a649ce7c7c7b..ed4c3bb13b1c116391ce735bf7b72f8265f25857 100644 (file)
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
static unsigned char input_buffer[4096];
static unsigned int input_offset, input_len;
static off_t consumed_bytes;
+static unsigned deepest_delta;
static git_SHA_CTX input_ctx;
static uint32_t input_crc32;
static int input_fd, output_fd, pack_fd;
delta_obj->real_type = base->obj->real_type;
delta_obj->delta_depth = base->obj->delta_depth + 1;
+ if (deepest_delta < delta_obj->delta_depth)
+ deepest_delta = delta_obj->delta_depth;
delta_obj->base_object_no = base->obj - objects;
delta_data = get_data_from_pack(delta_obj);
base_data = get_base_data(base);
@@ -973,12 +976,17 @@ static void read_idx_option(struct pack_idx_option *opts, const char *pack_name)
static void show_pack_info(int stat_only)
{
- int i;
+ int i, baseobjects = nr_objects - nr_deltas;
+ unsigned long *chain_histogram = NULL;
+
+ if (deepest_delta)
+ chain_histogram = xcalloc(deepest_delta, sizeof(unsigned long));
+
for (i = 0; i < nr_objects; i++) {
struct object_entry *obj = &objects[i];
- /* NEEDSWORK: Compute data necessary for the "histogram" here */
-
+ if (is_delta_type(obj->type))
+ chain_histogram[obj->delta_depth - 1]++;
if (stat_only)
continue;
printf("%s %-6s %lu %lu %"PRIuMAX,
}
putchar('\n');
}
+
+ if (baseobjects)
+ printf("non delta: %d object%s\n",
+ baseobjects, baseobjects > 1 ? "s" : "");
+ for (i = 0; i < deepest_delta; i++) {
+ if (!chain_histogram[i])
+ continue;
+ printf("chain length = %d: %lu object%s\n",
+ i + 1,
+ chain_histogram[i],
+ chain_histogram[i] > 1 ? "s" : "");
+ }
}
int cmd_index_pack(int argc, const char **argv, const char *prefix)