diff options
author | René Scharfe <l.s.r@web.de> | 2023-07-21 15:41:53 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-07-21 20:04:04 +0300 |
commit | 36f76d2a253a0346491cc127de5ca4b9f7895d60 (patch) | |
tree | 1fb98baad385b0c691a0cbb55210962c9201ccea /builtin/pack-objects.c | |
parent | 3a5f30874120880ddaa53d0db4c3b4ec0a07297a (diff) |
pack-objects: fix --no-quiet
Since 99fb6e04cb (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 <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r-- | builtin/pack-objects.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 193bb0b0df..697662c655 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -4118,6 +4118,18 @@ static void add_extra_kept_packs(const struct string_list *names) } } +static int option_parse_quiet(const struct option *opt, const char *arg, + int unset) +{ + BUG_ON_OPT_ARG(arg); + + if (!unset) + progress = 0; + else if (!progress) + progress = 1; + return 0; +} + static int option_parse_index_version(const struct option *opt, const char *arg, int unset) { @@ -4179,8 +4191,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) LIST_OBJECTS_FILTER_INIT; struct option pack_objects_options[] = { - OPT_SET_INT('q', "quiet", &progress, - N_("do not show progress meter"), 0), + OPT_CALLBACK_F('q', "quiet", NULL, NULL, + N_("do not show progress meter"), + PARSE_OPT_NOARG, option_parse_quiet), OPT_SET_INT(0, "progress", &progress, N_("show progress meter"), 1), OPT_SET_INT(0, "all-progress", &progress, |