Skip to content

Commit 13980c8

Browse files
ttaylorrgitster
authored andcommitted
builtin/multi-pack-index.c: make '--progress' a common option
All multi-pack-index sub-commands (write, verify, repack, and expire) support a '--progress' command-line option, despite not listing it as one of the common options in `common_opts`. As a result each sub-command declares its own `OPT_BIT()` for a "--progress" command-line option. Centralize this within the `common_opts` to avoid re-declaring it in each sub-command. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent fcf3d68 commit 13980c8

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Documentation/git-multi-pack-index.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Write or verify a multi-pack-index (MIDX) file.
1818
OPTIONS
1919
-------
2020

21+
The following command-line options are applicable to all sub-commands:
22+
2123
--object-dir=<dir>::
2224
Use given directory for the location of Git objects. We check
2325
`<dir>/packs/multi-pack-index` for the current MIDX file, and

builtin/multi-pack-index.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ static struct option common_opts[] = {
8484
N_("directory"),
8585
N_("object directory containing set of packfile and pack-index pairs"),
8686
parse_object_dir),
87+
OPT_BIT(0, "progress", &opts.flags, N_("force progress reporting"),
88+
MIDX_PROGRESS),
8789
OPT_END(),
8890
};
8991

@@ -138,8 +140,6 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
138140
N_("pack for reuse when computing a multi-pack bitmap")),
139141
OPT_BIT(0, "bitmap", &opts.flags, N_("write multi-pack bitmap"),
140142
MIDX_WRITE_BITMAP | MIDX_WRITE_REV_INDEX),
141-
OPT_BIT(0, "progress", &opts.flags,
142-
N_("force progress reporting"), MIDX_PROGRESS),
143143
OPT_BIT(0, "incremental", &opts.flags,
144144
N_("write a new incremental MIDX"), MIDX_WRITE_INCREMENTAL),
145145
OPT_BOOL(0, "stdin-packs", &opts.stdin_packs,
@@ -200,8 +200,6 @@ static int cmd_multi_pack_index_verify(int argc, const char **argv,
200200
{
201201
struct option *options;
202202
static struct option builtin_multi_pack_index_verify_options[] = {
203-
OPT_BIT(0, "progress", &opts.flags,
204-
N_("force progress reporting"), MIDX_PROGRESS),
205203
OPT_END(),
206204
};
207205
struct odb_source *source;
@@ -231,8 +229,6 @@ static int cmd_multi_pack_index_expire(int argc, const char **argv,
231229
{
232230
struct option *options;
233231
static struct option builtin_multi_pack_index_expire_options[] = {
234-
OPT_BIT(0, "progress", &opts.flags,
235-
N_("force progress reporting"), MIDX_PROGRESS),
236232
OPT_END(),
237233
};
238234
struct odb_source *source;
@@ -264,8 +260,6 @@ static int cmd_multi_pack_index_repack(int argc, const char **argv,
264260
static struct option builtin_multi_pack_index_repack_options[] = {
265261
OPT_UNSIGNED(0, "batch-size", &opts.batch_size,
266262
N_("during repack, collect pack-files of smaller size into a batch that is larger than this size")),
267-
OPT_BIT(0, "progress", &opts.flags,
268-
N_("force progress reporting"), MIDX_PROGRESS),
269263
OPT_END(),
270264
};
271265
struct odb_source *source;

0 commit comments

Comments
 (0)