Skip to content

Commit cf1f538

Browse files
ttaylorrgitster
authored andcommitted
builtin/multi-pack-index.c: don't handle 'progress' separately
Now that there is a shared 'flags' member in the options structure, there is no need to keep track of whether to force progress or not, since ultimately the decision of whether or not to show a progress meter is controlled by a bit in the flags member. Manipulate that bit directly, and drop the now-unnecessary 'progress' field while we're at it. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f7c4d63 commit cf1f538

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

builtin/multi-pack-index.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ static char const * const builtin_multi_pack_index_usage[] = {
1313
static struct opts_multi_pack_index {
1414
const char *object_dir;
1515
unsigned long batch_size;
16-
int progress;
1716
unsigned flags;
1817
} opts;
1918

@@ -23,23 +22,22 @@ int cmd_multi_pack_index(int argc, const char **argv,
2322
static struct option builtin_multi_pack_index_options[] = {
2423
OPT_FILENAME(0, "object-dir", &opts.object_dir,
2524
N_("object directory containing set of packfile and pack-index pairs")),
26-
OPT_BOOL(0, "progress", &opts.progress, N_("force progress reporting")),
25+
OPT_BIT(0, "progress", &opts.flags, N_("force progress reporting"), MIDX_PROGRESS),
2726
OPT_MAGNITUDE(0, "batch-size", &opts.batch_size,
2827
N_("during repack, collect pack-files of smaller size into a batch that is larger than this size")),
2928
OPT_END(),
3029
};
3130

3231
git_config(git_default_config, NULL);
3332

34-
opts.progress = isatty(2);
33+
if (isatty(2))
34+
opts.flags |= MIDX_PROGRESS;
3535
argc = parse_options(argc, argv, prefix,
3636
builtin_multi_pack_index_options,
3737
builtin_multi_pack_index_usage, 0);
3838

3939
if (!opts.object_dir)
4040
opts.object_dir = get_object_directory();
41-
if (opts.progress)
42-
opts.flags |= MIDX_PROGRESS;
4341

4442
if (argc == 0)
4543
usage_with_options(builtin_multi_pack_index_usage,

0 commit comments

Comments
 (0)