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>

Taylor Blau committed Feb 24, 2026 at 13:59 UTC 6b8fb17490f637f5651834596b08cdb255e9280a
2 files changed +4 -8
Documentation/git-multi-pack-index.adoc
+2
@@ -18,6 +18,8 @@ Write or verify a multi-pack-index (MIDX) file.
18 OPTIONS
19 -------
20
21 +The following command-line options are applicable to all sub-commands:
22 +
23 --object-dir=<dir>::
24 Use given directory for the location of Git objects. We check
25 `<dir>/packs/multi-pack-index` for the current MIDX file, and
builtin/multi-pack-index.c
+2 -8
@@ -84,6 +84,8 @@ static struct option common_opts[] = {
84 N_("directory"),
85 N_("object directory containing set of packfile and pack-index pairs"),
86 parse_object_dir),
87 + OPT_BIT(0, "progress", &opts.flags, N_("force progress reporting"),
88 + MIDX_PROGRESS),
89 OPT_END(),
90 };
91
@@ -138,8 +140,6 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
140 N_("pack for reuse when computing a multi-pack bitmap")),
141 OPT_BIT(0, "bitmap", &opts.flags, N_("write multi-pack bitmap"),
142 MIDX_WRITE_BITMAP | MIDX_WRITE_REV_INDEX),
141 - OPT_BIT(0, "progress", &opts.flags,
142 - N_("force progress reporting"), MIDX_PROGRESS),
143 OPT_BIT(0, "incremental", &opts.flags,
144 N_("write a new incremental MIDX"), MIDX_WRITE_INCREMENTAL),
145 OPT_BOOL(0, "stdin-packs", &opts.stdin_packs,
@@ -200,8 +200,6 @@ static int cmd_multi_pack_index_verify(int argc, const char **argv,
200 {
201 struct option *options;
202 static struct option builtin_multi_pack_index_verify_options[] = {
203 - OPT_BIT(0, "progress", &opts.flags,
204 - N_("force progress reporting"), MIDX_PROGRESS),
203 OPT_END(),
204 };
205 struct odb_source *source;
@@ -231,8 +229,6 @@ static int cmd_multi_pack_index_expire(int argc, const char **argv,
229 {
230 struct option *options;
231 static struct option builtin_multi_pack_index_expire_options[] = {
234 - OPT_BIT(0, "progress", &opts.flags,
235 - N_("force progress reporting"), MIDX_PROGRESS),
232 OPT_END(),
233 };
234 struct odb_source *source;
@@ -264,8 +260,6 @@ static int cmd_multi_pack_index_repack(int argc, const char **argv,
260 static struct option builtin_multi_pack_index_repack_options[] = {
261 OPT_UNSIGNED(0, "batch-size", &opts.batch_size,
262 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),
263 OPT_END(),
264 };
265 struct odb_source *source;