Skip to content

Commit 36f76d2

Browse files
rscharfegitster
authored andcommitted
pack-objects: fix --no-quiet
Since 99fb6e0 (pack-objects: convert to use parse_options(), 2012-02-01) git pack-objects has accepted the option --no-quiet, but it does the same as --quiet. That's because it's defined using OPT_SET_INT with a value of 0, which sets 0 when negated, too. Make --no-quiet equivalent to --progress and ignore it if --all-progress was given. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3a5f308 commit 36f76d2

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

builtin/pack-objects.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4118,6 +4118,18 @@ static void add_extra_kept_packs(const struct string_list *names)
41184118
}
41194119
}
41204120

4121+
static int option_parse_quiet(const struct option *opt, const char *arg,
4122+
int unset)
4123+
{
4124+
BUG_ON_OPT_ARG(arg);
4125+
4126+
if (!unset)
4127+
progress = 0;
4128+
else if (!progress)
4129+
progress = 1;
4130+
return 0;
4131+
}
4132+
41214133
static int option_parse_index_version(const struct option *opt,
41224134
const char *arg, int unset)
41234135
{
@@ -4179,8 +4191,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
41794191
LIST_OBJECTS_FILTER_INIT;
41804192

41814193
struct option pack_objects_options[] = {
4182-
OPT_SET_INT('q', "quiet", &progress,
4183-
N_("do not show progress meter"), 0),
4194+
OPT_CALLBACK_F('q', "quiet", NULL, NULL,
4195+
N_("do not show progress meter"),
4196+
PARSE_OPT_NOARG, option_parse_quiet),
41844197
OPT_SET_INT(0, "progress", &progress,
41854198
N_("show progress meter"), 1),
41864199
OPT_SET_INT(0, "all-progress", &progress,

0 commit comments

Comments
 (0)