multi-pack-index: add 'write' verb
[git/git.git] / builtin / multi-pack-index.c
index 3161dda..6a7aa00 100644 (file)
@@ -2,9 +2,10 @@
 #include "cache.h"
 #include "config.h"
 #include "parse-options.h"
 #include "cache.h"
 #include "config.h"
 #include "parse-options.h"
+#include "midx.h"
 
 static char const * const builtin_multi_pack_index_usage[] = {
 
 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"),
        NULL
 };
 
        NULL
 };
 
@@ -30,5 +31,17 @@ int cmd_multi_pack_index(int argc, const char **argv,
        if (!opts.object_dir)
                opts.object_dir = get_object_directory();
 
        if (!opts.object_dir)
                opts.object_dir = get_object_directory();
 
-       return 0;
+       if (argc == 0)
+               goto usage;
+
+       if (!strcmp(argv[0], "write")) {
+               if (argc > 1)
+                       goto usage;
+
+               return write_midx_file(opts.object_dir);
+       }
+
+usage:
+       usage_with_options(builtin_multi_pack_index_usage,
+                          builtin_multi_pack_index_options);
 }
 }