multi-pack-index: add builtin

This new 'git multi-pack-index' builtin will be the plumbing access for writing, reading, and checking multi-pack-index files. The initial implementation is a no-op. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Jul 12, 2018 at 15:39 UTC 6a257f03ba9b86c744064d08df98db1847cf1722
7 files changed +76 -1
.gitignore
+2 -1
@@ -99,8 +99,9 @@
99 /git-mergetool--lib
100 /git-mktag
101 /git-mktree
102 -/git-name-rev
102 +/git-multi-pack-index
103 /git-mv
104 +/git-name-rev
105 /git-notes
106 /git-p4
107 /git-pack-redundant
Documentation/git-multi-pack-index.txt new
+36
@@ -0,0 +1,36 @@
1 +git-multi-pack-index(1)
2 +=======================
3 +
4 +NAME
5 +----
6 +git-multi-pack-index - Write and verify multi-pack-indexes
7 +
8 +
9 +SYNOPSIS
10 +--------
11 +[verse]
12 +'git multi-pack-index' [--object-dir=<dir>]
13 +
14 +DESCRIPTION
15 +-----------
16 +Write or verify a multi-pack-index (MIDX) file.
17 +
18 +OPTIONS
19 +-------
20 +
21 +--object-dir=<dir>::
22 + Use given directory for the location of Git objects. We check
23 + `<dir>/packs/multi-pack-index` for the current MIDX file, and
24 + `<dir>/packs` for the pack-files to index.
25 +
26 +
27 +SEE ALSO
28 +--------
29 +See link:technical/multi-pack-index.html[The Multi-Pack-Index Design
30 +Document] and link:technical/pack-format.html[The Multi-Pack-Index
31 +Format] for more information on the multi-pack-index feature.
32 +
33 +
34 +GIT
35 +---
36 +Part of the linkgit:git[1] suite
Makefile
+1
@@ -1047,6 +1047,7 @@ BUILTIN_OBJS += builtin/merge-recursive.o
1047 BUILTIN_OBJS += builtin/merge-tree.o
1048 BUILTIN_OBJS += builtin/mktag.o
1049 BUILTIN_OBJS += builtin/mktree.o
1050 +BUILTIN_OBJS += builtin/multi-pack-index.o
1051 BUILTIN_OBJS += builtin/mv.o
1052 BUILTIN_OBJS += builtin/name-rev.o
1053 BUILTIN_OBJS += builtin/notes.o
builtin.h
+1
@@ -191,6 +191,7 @@ extern int cmd_merge_recursive(int argc, const char **argv, const char *prefix);
191 extern int cmd_merge_tree(int argc, const char **argv, const char *prefix);
192 extern int cmd_mktag(int argc, const char **argv, const char *prefix);
193 extern int cmd_mktree(int argc, const char **argv, const char *prefix);
194 +extern int cmd_multi_pack_index(int argc, const char **argv, const char *prefix);
195 extern int cmd_mv(int argc, const char **argv, const char *prefix);
196 extern int cmd_name_rev(int argc, const char **argv, const char *prefix);
197 extern int cmd_notes(int argc, const char **argv, const char *prefix);
builtin/multi-pack-index.c new
+34
@@ -0,0 +1,34 @@
1 +#include "builtin.h"
2 +#include "cache.h"
3 +#include "config.h"
4 +#include "parse-options.h"
5 +
6 +static char const * const builtin_multi_pack_index_usage[] = {
7 + N_("git multi-pack-index [--object-dir=<dir>]"),
8 + NULL
9 +};
10 +
11 +static struct opts_multi_pack_index {
12 + const char *object_dir;
13 +} opts;
14 +
15 +int cmd_multi_pack_index(int argc, const char **argv,
16 + const char *prefix)
17 +{
18 + static struct option builtin_multi_pack_index_options[] = {
19 + OPT_FILENAME(0, "object-dir", &opts.object_dir,
20 + N_("object directory containing set of packfile and pack-index pairs")),
21 + OPT_END(),
22 + };
23 +
24 + git_config(git_default_config, NULL);
25 +
26 + argc = parse_options(argc, argv, prefix,
27 + builtin_multi_pack_index_options,
28 + builtin_multi_pack_index_usage, 0);
29 +
30 + if (!opts.object_dir)
31 + opts.object_dir = get_object_directory();
32 +
33 + return 0;
34 +}
command-list.txt
+1
@@ -123,6 +123,7 @@ git-merge-index plumbingmanipulators
123 git-merge-one-file purehelpers
124 git-mergetool ancillarymanipulators complete
125 git-merge-tree ancillaryinterrogators
126 +git-multi-pack-index plumbingmanipulators
127 git-mktag plumbingmanipulators
128 git-mktree plumbingmanipulators
129 git-mv mainporcelain worktree
git.c
+1
@@ -505,6 +505,7 @@ static struct cmd_struct commands[] = {
505 { "merge-tree", cmd_merge_tree, RUN_SETUP | NO_PARSEOPT },
506 { "mktag", cmd_mktag, RUN_SETUP | NO_PARSEOPT },
507 { "mktree", cmd_mktree, RUN_SETUP },
508 + { "multi-pack-index", cmd_multi_pack_index, RUN_SETUP_GENTLY },
509 { "mv", cmd_mv, RUN_SETUP | NEED_WORK_TREE },
510 { "name-rev", cmd_name_rev, RUN_SETUP },
511 { "notes", cmd_notes, RUN_SETUP },