From: Junio C Hamano <gitster@pobox.com>
To: Jerry Zhang <jerry@skydio.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH V3 1/2] git-apply: add --quiet flag
Date: Mon, 13 Dec 2021 14:30:14 -0800 [thread overview]
Message-ID: <xmqqmtl49lzd.fsf@gitster.g> (raw)
In-Reply-To: <20211213220327.16042-1-jerry@skydio.com> (Jerry Zhang's message of "Mon, 13 Dec 2021 14:03:26 -0800")
Jerry Zhang <jerry@skydio.com> writes:
> Replace OPT_VERBOSE with OPT_VERBOSITY.
>
> This adds a --quiet flag to "git apply" so the user can turn down
> the verbosity.
>
> Signed-off-by: Jerry Zhang <jerry@skydio.com>
> ---
> V2->V3
> - Reorganized into a patch series to capture
> dependencies between 2 git apply changes.
>
> Documentation/git-apply.txt | 7 ++++++-
> apply.c | 2 +-
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
> index aa1ae56a25..a32ad64718 100644
> --- a/Documentation/git-apply.txt
> +++ b/Documentation/git-apply.txt
> @@ -14,11 +14,11 @@ SYNOPSIS
> [--allow-binary-replacement | --binary] [--reject] [-z]
> [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached]
> [--ignore-space-change | --ignore-whitespace]
> [--whitespace=(nowarn|warn|fix|error|error-all)]
> [--exclude=<path>] [--include=<path>] [--directory=<root>]
> - [--verbose] [--unsafe-paths] [<patch>...]
> + [--verbose | --quiet] [--unsafe-paths] [<patch>...]
>
> DESCRIPTION
> -----------
> Reads the supplied diff output (i.e. "a patch") and applies it to files.
> When running from a subdirectory in a repository, patched paths
> @@ -226,10 +226,15 @@ behavior:
> --verbose::
> Report progress to stderr. By default, only a message about the
> current patch being applied will be printed. This option will cause
> additional information to be reported.
>
> +-q::
> +--quiet::
> + Suppress stderr output. Messages about patch status and progress
> + will not be printed.
> +
> --recount::
> Do not trust the line counts in the hunk headers, but infer them
> by inspecting the patch (e.g. after editing the patch without
> adjusting the hunk headers appropriately).
>
> diff --git a/apply.c b/apply.c
> index 64b226acd9..9f00f882a2 100644
> --- a/apply.c
> +++ b/apply.c
> @@ -5071,11 +5071,11 @@ int apply_parse_options(int argc, const char **argv,
> N_("don't expect at least one line of context")),
> OPT_BOOL(0, "reject", &state->apply_with_reject,
> N_("leave the rejected hunks in corresponding *.rej files")),
> OPT_BOOL(0, "allow-overlap", &state->allow_overlap,
> N_("allow overlapping hunks")),
> - OPT__VERBOSE(&state->apply_verbosity, N_("be verbose")),
> + OPT__VERBOSITY(&state->apply_verbosity),
> OPT_BIT(0, "inaccurate-eof", options,
> N_("tolerate incorrectly detected missing new-line at the end of file"),
> APPLY_OPT_INACCURATE_EOF),
> OPT_BIT(0, "recount", options,
> N_("do not trust the line counts in the hunk headers"),
It is a bit surprising that this is the only change that is needed.
apply.h has
enum apply_verbosity {
verbosity_silent = -1,
verbosity_normal = 0,
verbosity_verbose = 1
};
but OPT__VERBOSITY() cna take more than one --verbose or --quiet to
tune the verbosity level beyond the 1 and -1 limit.
I looked at the output from
$ git grep -A3 -e '\([.]\|->\)apply_verbosity'
and made sure that there is no exact comparison with
verbosity_silent or verbosity_verbose, which means we are OK.
It would have saved time to have a note in the proposed log message
that the author already audited and found that the existing code is
ready to accept verbosity values outside the "enum apply_verbosity"
range.
Thanks, will queue.
prev parent reply other threads:[~2021-12-13 22:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 22:03 [PATCH V3 1/2] git-apply: add --quiet flag Jerry Zhang
2021-12-13 22:03 ` [PATCH V5 2/2] git-apply: add --allow-empty flag Jerry Zhang
2021-12-16 1:40 ` Junio C Hamano
2021-12-16 23:11 ` [PATCH] t4204 is not sanitizer clean at all Junio C Hamano
2021-12-17 4:39 ` Ævar Arnfjörð Bjarmason
2021-12-17 20:48 ` Junio C Hamano
2021-12-17 22:23 ` Ævar Arnfjörð Bjarmason
2021-12-16 23:37 ` [PATCH] format-patch: mark rev_info with UNLEAK Junio C Hamano
2021-12-17 4:51 ` [PATCH V5 2/2] git-apply: add --allow-empty flag Ævar Arnfjörð Bjarmason
2021-12-17 20:48 ` Junio C Hamano
2021-12-17 22:28 ` Ævar Arnfjörð Bjarmason
2021-12-17 22:32 ` Junio C Hamano
2021-12-13 22:30 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqmtl49lzd.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jerry@skydio.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.