travis-ci: record and skip successfully built trees
[gitweb.git] / builtin / count-objects.c
index ba9291944f7752a0b7c671cd4d63309a15ba5df2..1d82e61f2a6391bd93a6c3dd91a2515189ff79cc 100644 (file)
@@ -5,9 +5,11 @@
  */
 
 #include "cache.h"
+#include "config.h"
 #include "dir.h"
 #include "builtin.h"
 #include "parse-options.h"
+#include "quote.h"
 
 static unsigned long garbage;
 static off_t size_garbage;
@@ -52,7 +54,7 @@ static void loose_garbage(const char *path)
                report_garbage(PACKDIR_FILE_GARBAGE, path);
 }
 
-static int count_loose(const unsigned char *sha1, const char *path, void *data)
+static int count_loose(const struct object_id *oid, const char *path, void *data)
 {
        struct stat st;
 
@@ -61,7 +63,7 @@ static int count_loose(const unsigned char *sha1, const char *path, void *data)
        else {
                loose_size += on_disk_bytes(st);
                loose++;
-               if (verbose && has_sha1_pack(sha1))
+               if (verbose && has_sha1_pack(oid->hash))
                        packed_loose++;
        }
        return 0;
@@ -73,6 +75,14 @@ static int count_cruft(const char *basename, const char *path, void *data)
        return 0;
 }
 
+static int print_alternate(struct alternate_object_database *alt, void *data)
+{
+       printf("alternate: ");
+       quote_c_style(alt->path, NULL, stdout, 0);
+       putchar('\n');
+       return 0;
+}
+
 static char const * const count_objects_usage[] = {
        N_("git count-objects [-v] [-H | --human-readable]"),
        NULL
@@ -88,6 +98,8 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
                OPT_END(),
        };
 
+       git_config(git_default_config, NULL);
+
        argc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0);
        /* we do not take arguments other than flags for now */
        if (argc)
@@ -140,6 +152,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
                printf("prune-packable: %lu\n", packed_loose);
                printf("garbage: %lu\n", garbage);
                printf("size-garbage: %s\n", garbage_buf.buf);
+               foreach_alt_odb(print_alternate, NULL);
                strbuf_release(&loose_buf);
                strbuf_release(&pack_buf);
                strbuf_release(&garbage_buf);