summaryrefslogtreecommitdiff
path: root/builtin/multi-pack-index.c
diff options
context:
space:
mode:
authorDerrick Stolee <stolee@gmail.com>2018-07-12 19:39:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-20 18:27:28 (GMT)
commita3407730261b11b45dda131464b73ec29922392a (patch)
tree8a90e90443a4e3d6b69c8afbeae2dcc436eb18eb /builtin/multi-pack-index.c
parent6a257f03ba9b86c744064d08df98db1847cf1722 (diff)
downloadgit-a3407730261b11b45dda131464b73ec29922392a.zip
git-a3407730261b11b45dda131464b73ec29922392a.tar.gz
git-a3407730261b11b45dda131464b73ec29922392a.tar.bz2
multi-pack-index: add 'write' verb
In anticipation of writing multi-pack-indexes, add a skeleton 'git multi-pack-index write' subcommand and send the options to a write_midx_file() method. Also create a skeleton test script that tests the 'write' subcommand. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/multi-pack-index.c')
-rw-r--r--builtin/multi-pack-index.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index 3161dda..6a7aa00 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -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"),
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();
- 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);
}