@matheusbsbs / matheus-bagliano / commits / f223824943
Fork 0

count-objects: Add total pack size to verbose output

Adds the total pack size (including indexes) the verbose count-objects output, floored to the nearest kilobyte. Updates documentation to match this addition. Signed-off-by: Marcus Griep <marcus@griep.us> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Marcus Griep committed Aug 15, 2008 at 00:20 UTC f223824943e23e593b5e9cc647417a4267acc82d
3 files changed +7 -3
Documentation/git-count-objects.txt
+3 -2
@@ -21,8 +21,9 @@ OPTIONS
21 --verbose::
22 In addition to the number of loose objects and disk
23 space consumed, it reports the number of in-pack
24 - objects, number of packs, and number of objects that can be
25 - removed by running `git prune-packed`.
24 + objects, number of packs, disk space consumed by those packs,
25 + and number of objects that can be removed by running
26 + `git prune-packed`.
27
28
29 Author
builtin-count-objects.c
+3
@@ -104,6 +104,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
104 if (verbose) {
105 struct packed_git *p;
106 unsigned long num_pack = 0;
107 + unsigned long size_pack = 0;
108 if (!packed_git)
109 prepare_packed_git();
110 for (p = packed_git; p; p = p->next) {
@@ -112,12 +113,14 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
113 if (open_pack_index(p))
114 continue;
115 packed += p->num_objects;
116 + size_pack += p->pack_size + p->index_size;
117 num_pack++;
118 }
119 printf("count: %lu\n", loose);
120 printf("size: %lu\n", loose_size / 2);
121 printf("in-pack: %lu\n", packed);
122 printf("packs: %lu\n", num_pack);
123 + printf("size-pack: %lu\n", size_pack / 1024);
124 printf("prune-packable: %lu\n", packed_loose);
125 printf("garbage: %lu\n", garbage);
126 }
t/t5500-fetch-pack.sh
+1 -1
@@ -137,7 +137,7 @@ test_expect_success "clone shallow object count" \
137 "test \"in-pack: 18\" = \"$(grep in-pack count.shallow)\""
138
139 count_output () {
140 - sed -e '/^in-pack:/d' -e '/^packs:/d' -e '/: 0$/d' "$1"
140 + sed -e '/^in-pack:/d' -e '/^packs:/d' -e '/^size-pack:/d' -e '/: 0$/d' "$1"
141 }
142
143 test_expect_success "clone shallow object count (part 2)" '