Merge branch 'tb/log-G-binary'
[git.git] / builtin / multi-pack-index.c
blobfca70f8e4fcca8432619c41fd68234732a92f07a
1 #include "builtin.h"
2 #include "cache.h"
3 #include "config.h"
4 #include "parse-options.h"
5 #include "midx.h"
7 static char const * const builtin_multi_pack_index_usage[] = {
8 N_("git multi-pack-index [--object-dir=<dir>] (write|verify)"),
9 NULL
12 static struct opts_multi_pack_index {
13 const char *object_dir;
14 } opts;
16 int cmd_multi_pack_index(int argc, const char **argv,
17 const char *prefix)
19 static struct option builtin_multi_pack_index_options[] = {
20 OPT_FILENAME(0, "object-dir", &opts.object_dir,
21 N_("object directory containing set of packfile and pack-index pairs")),
22 OPT_END(),
25 git_config(git_default_config, NULL);
27 argc = parse_options(argc, argv, prefix,
28 builtin_multi_pack_index_options,
29 builtin_multi_pack_index_usage, 0);
31 if (!opts.object_dir)
32 opts.object_dir = get_object_directory();
34 if (argc == 0)
35 usage_with_options(builtin_multi_pack_index_usage,
36 builtin_multi_pack_index_options);
38 if (argc > 1) {
39 die(_("too many arguments"));
40 return 1;
43 if (!strcmp(argv[0], "write"))
44 return write_midx_file(opts.object_dir);
45 if (!strcmp(argv[0], "verify"))
46 return verify_midx_file(opts.object_dir);
48 die(_("unrecognized verb: %s"), argv[0]);