pack-redundant: rename pack_list.all_objects
[gitweb.git] / builtin / multi-pack-index.c
index 3161ddae86d6894f5c7c8f0858ebc31cbd77a67b..fca70f8e4fcca8432619c41fd68234732a92f07a 100644 (file)
@@ -2,9 +2,10 @@
 #include "cache.h"
 #include "config.h"
 #include "parse-options.h"
+#include "midx.h"
 
 static char const * const builtin_multi_pack_index_usage[] = {
-       N_("git multi-pack-index [--object-dir=<dir>]"),
+       N_("git multi-pack-index [--object-dir=<dir>] (write|verify)"),
        NULL
 };
 
@@ -30,5 +31,19 @@ int cmd_multi_pack_index(int argc, const char **argv,
        if (!opts.object_dir)
                opts.object_dir = get_object_directory();
 
-       return 0;
+       if (argc == 0)
+               usage_with_options(builtin_multi_pack_index_usage,
+                                  builtin_multi_pack_index_options);
+
+       if (argc > 1) {
+               die(_("too many arguments"));
+               return 1;
+       }
+
+       if (!strcmp(argv[0], "write"))
+               return write_midx_file(opts.object_dir);
+       if (!strcmp(argv[0], "verify"))
+               return verify_midx_file(opts.object_dir);
+
+       die(_("unrecognized verb: %s"), argv[0]);
 }