summaryrefslogtreecommitdiff
path: root/builtin-count-objects.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-count-objects.c')
-rw-r--r--builtin-count-objects.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/builtin-count-objects.c b/builtin-count-objects.c
index 91b5487..62fd1f0 100644
--- a/builtin-count-objects.c
+++ b/builtin-count-objects.c
@@ -5,6 +5,7 @@
*/
#include "cache.h"
+#include "dir.h"
#include "builtin.h"
#include "parse-options.h"
@@ -21,9 +22,7 @@ static void count_objects(DIR *d, char *path, int len, int verbose,
const char *cp;
int bad = 0;
- if ((ent->d_name[0] == '.') &&
- (ent->d_name[1] == 0 ||
- ((ent->d_name[1] == '.') && (ent->d_name[2] == 0))))
+ if (is_dot_or_dotdot(ent->d_name))
continue;
for (cp = ent->d_name; *cp; cp++) {
int ch = *cp;
@@ -43,7 +42,7 @@ static void count_objects(DIR *d, char *path, int len, int verbose,
if (lstat(path, &st) || !S_ISREG(st.st_mode))
bad = 1;
else
- (*loose_size) += xsize_t(st.st_blocks);
+ (*loose_size) += xsize_t(on_disk_bytes(st));
}
if (bad) {
if (verbose) {
@@ -104,6 +103,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
if (verbose) {
struct packed_git *p;
unsigned long num_pack = 0;
+ unsigned long size_pack = 0;
if (!packed_git)
prepare_packed_git();
for (p = packed_git; p; p = p->next) {
@@ -112,17 +112,19 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
if (open_pack_index(p))
continue;
packed += p->num_objects;
+ size_pack += p->pack_size + p->index_size;
num_pack++;
}
printf("count: %lu\n", loose);
- printf("size: %lu\n", loose_size / 2);
+ printf("size: %lu\n", loose_size / 1024);
printf("in-pack: %lu\n", packed);
printf("packs: %lu\n", num_pack);
+ printf("size-pack: %lu\n", size_pack / 1024);
printf("prune-packable: %lu\n", packed_loose);
printf("garbage: %lu\n", garbage);
}
else
printf("%lu objects, %lu kilobytes\n",
- loose, loose_size / 2);
+ loose, loose_size / 1024);
return 0;
}