{"thread":{"id":"55572","subject":"[PATCH] git-apply: add --quiet flag","startedAt":"2021-04-27T19:41:17Z","lastAt":"2021-12-11T02:08:08Z","messageCount":6,"participants":["Jerry Zhang","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"423127","messageId":"20210427194106.14500-1-jerry@skydio.com","threadId":"55572","inReplyTo":null,"subject":"[PATCH] git-apply: add --quiet flag","fromName":"Jerry Zhang","fromEmail":"jerry@skydio.com","sentAt":"2021-04-27T19:41:06Z","receivedAt":"2021-04-27T19:41:17Z","isPatch":true,"sender":{"key":"jerry@skydio.com","avatar":"https://avatars.githubusercontent.com/u/81337184?v=4"},"body":"Replace OPT_VERBOSE with OPT_VERBOSITY.\n\nThis adds a --quiet flag to \"git apply\" so\nthe user can turn down the verbosity.\n\nSigned-off-by: Jerry Zhang <jerry@skydio.com>\n---\n Documentation/git-apply.txt | 7 ++++++-\n apply.c                     | 2 +-\n 2 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt\nindex aa1ae56a25..a32ad64718 100644\n--- a/Documentation/git-apply.txt\n+++ b/Documentation/git-apply.txt\n@@ -16,7 +16,7 @@ SYNOPSIS\n \t  [--ignore-space-change | --ignore-whitespace]\n \t  [--whitespace=(nowarn|warn|fix|error|error-all)]\n \t  [--exclude=<path>] [--include=<path>] [--directory=<root>]\n-\t  [--verbose] [--unsafe-paths] [<patch>...]\n+\t  [--verbose | --quiet] [--unsafe-paths] [<patch>...]\n \n DESCRIPTION\n -----------\n@@ -228,6 +228,11 @@ behavior:\n \tcurrent patch being applied will be printed. This option will cause\n \tadditional information to be reported.\n \n+-q::\n+--quiet::\n+\tSuppress stderr output. Messages about patch status and progress\n+\twill not be printed.\n+\n --recount::\n \tDo not trust the line counts in the hunk headers, but infer them\n \tby inspecting the patch (e.g. after editing the patch without\ndiff --git a/apply.c b/apply.c\nindex 7aa49e2048..918e0988bb 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -5051,7 +5051,7 @@ int apply_parse_options(int argc, const char **argv,\n \t\t\tN_(\"leave the rejected hunks in corresponding *.rej files\")),\n \t\tOPT_BOOL(0, \"allow-overlap\", &state->allow_overlap,\n \t\t\tN_(\"allow overlapping hunks\")),\n-\t\tOPT__VERBOSE(&state->apply_verbosity, N_(\"be verbose\")),\n+\t\tOPT__VERBOSITY(&state->apply_verbosity),\n \t\tOPT_BIT(0, \"inaccurate-eof\", options,\n \t\t\tN_(\"tolerate incorrectly detected missing new-line at the end of file\"),\n \t\t\tAPPLY_OPT_INACCURATE_EOF),\n-- \n2.29.0\n\n"},{"id":"423183","messageId":"xmqq35vac0vq.fsf@gitster.g","threadId":"55572","inReplyTo":"20210427194106.14500-1-jerry@skydio.com","subject":"Re: [PATCH] git-apply: add --quiet flag","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-04-28T07:40:57Z","receivedAt":"2021-04-28T07:41:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jerry Zhang <jerry@skydio.com> writes:\n\n> Replace OPT_VERBOSE with OPT_VERBOSITY.\n\nWhile it is not an incorrect statement, it is odd to have such an\nimplementation detail nobody cares as the first thing in the log\nmessage, though.\n\n> This adds a --quiet flag to \"git apply\" so\n> the user can turn down the verbosity.\n\nSure, I think you can do \"apply --no-verbose\" to do the same thing\nwithout any change, but we introduced VERBOSITY to replace VERBOSE\nexactly so that --verbose can be countermanded with --quiet, and\nthis patch is a good example of the application of that feature.\n\nI wonder if this deserves a test.\n\nAlso, does \"git am\" have an \"--quiet\" option (or \"--verbose\" for\nthat matter), and if so, should it pass it down to underlying \"git\napply\" (this is not a rhetorical suggestion --- it is a genuine\nquestion---I am not particularly interested in changing \"am\")?\n\nThe patch text looks good.\n\nThanks.\n"},{"id":"423190","messageId":"xmqqsg3aahw7.fsf@gitster.g","threadId":"55572","inReplyTo":"xmqq35vac0vq.fsf@gitster.g","subject":"Re: [PATCH] git-apply: add --quiet flag","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-04-28T09:16:24Z","receivedAt":"2021-04-28T09:16:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jerry Zhang <jerry@skydio.com> writes:\n>\n>> Replace OPT_VERBOSE with OPT_VERBOSITY.\n>\n> While it is not an incorrect statement, it is odd to have such an\n> implementation detail nobody cares as the first thing in the log\n> message, though.\n>\n>> This adds a --quiet flag to \"git apply\" so\n>> the user can turn down the verbosity.\n>\n> Sure, I think you can do \"apply --no-verbose\" to do the same thing\n> without any change, but we introduced VERBOSITY to replace VERBOSE\n> exactly so that --verbose can be countermanded with --quiet, and\n> this patch is a good example of the application of that feature.\n>\n> I wonder if this deserves a test.\n\nOh, another thing.  \"--quiet\" with OPT_VERBOSITY is given negative\nvalues, whose magnitude may be used to express \"even more quiet\".\nThis is different from \"--no-verbose\" that is supported by both\nOPT_VERBOSITY and OPT_VERBOSE that resets the variable to 0.\n\nSo use of OPT_VERBOSITY() to support both --verbose and --quiet is\ngood, but you'd need to audit the way the verbosity variable is used\nby the code.  \"if (verbose) perform_verbosely()\" would have to be\nrewritten as \"if (verbose > verbosity_level) perform_verbosely()\" \nor something like that, as the \"verbose\" variable can take a\nnegative value to mean \"less silent than the usual 0\".\n\n"},{"id":"423209","messageId":"CAMKO5CutTaW51GkkM_+viES3UbrOKA6VN1nOWNK+poRkxiO-sg@mail.gmail.com","threadId":"55572","inReplyTo":"xmqqsg3aahw7.fsf@gitster.g","subject":"Re: [PATCH] git-apply: add --quiet flag","fromName":"Jerry Zhang","fromEmail":"jerry@skydio.com","sentAt":"2021-04-28T18:18:52Z","receivedAt":"2021-04-28T18:19:08Z","isPatch":true,"sender":{"key":"jerry@skydio.com","avatar":"https://avatars.githubusercontent.com/u/81337184?v=4"},"body":"On Wed, Apr 28, 2021 at 2:16 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n> > Jerry Zhang <jerry@skydio.com> writes:\n> >\n> >> Replace OPT_VERBOSE with OPT_VERBOSITY.\n> >\n> > While it is not an incorrect statement, it is odd to have such an\n> > implementation detail nobody cares as the first thing in the log\n> > message, though.\n> >\n> >> This adds a --quiet flag to \"git apply\" so\n> >> the user can turn down the verbosity.\n> >\n> > Sure, I think you can do \"apply --no-verbose\" to do the same thing\n> > without any change, but we introduced VERBOSITY to replace VERBOSE\n> > exactly so that --verbose can be countermanded with --quiet, and\n> > this patch is a good example of the application of that feature.\n> >\n> > I wonder if this deserves a test.\n>\n> Oh, another thing.  \"--quiet\" with OPT_VERBOSITY is given negative\n> values, whose magnitude may be used to express \"even more quiet\".\n> This is different from \"--no-verbose\" that is supported by both\n> OPT_VERBOSITY and OPT_VERBOSE that resets the variable to 0.\nOk I didn't realize every flag automatically came with a \"no\" version but\n--quiet is indeed what I'm looking for since I want to silence the status\nmessages but still print out really critical errors.\n>\n> So use of OPT_VERBOSITY() to support both --verbose and --quiet is\n> good, but you'd need to audit the way the verbosity variable is used\n> by the code.  \"if (verbose) perform_verbosely()\" would have to be\n> rewritten as \"if (verbose > verbosity_level) perform_verbosely()\"\n> or something like that, as the \"verbose\" variable can take a\n> negative value to mean \"less silent than the usual 0\".\nYeah luckily apply.c uses verbosity correctly and consistently\nthroughout.\n\n> Also, does \"git am\" have an \"--quiet\" option (or \"--verbose\" for\n> that matter), and if so, should it pass it down to underlying \"git\n> apply\" (this is not a rhetorical suggestion --- it is a genuine\n> question---I am not particularly interested in changing \"am\")?\nam seems to have --quiet but not --verbose. In addition am does\nnot seem to pass through those options into apply.c. I tested this\nusing a patch that has whitespace errors and \"git am\" prints\nwarning regardless of whether \"--quiet\" is used. However, interestingly\n\"git am --3way\" does not print warnings, due to these lines:\n\n       /*\n        * If we are allowed to fall back on 3-way merge, don't give false\n        * errors during the initial attempt.\n        */\n       if (state->threeway && !index_file)\n               apply_state.apply_verbosity = verbosity_silent;\n\nWhich no longer are relevant due to the previous changes making 3way\nhappen first. So in conclusion I think it might be worthwhile to make\nthe verbosity flags of \"am\" pass down to \"apply\", although it would be\nout of the scope of this change.\n"},{"id":"431379","messageId":"20210728032230.24611-1-jerry@skydio.com","threadId":"55572","inReplyTo":"20210427194106.14500-1-jerry@skydio.com","subject":"[PATCH V2] git-apply: add --quiet flag","fromName":"Jerry Zhang","fromEmail":"jerry@skydio.com","sentAt":"2021-07-28T03:22:30Z","receivedAt":"2021-07-28T03:22:36Z","isPatch":true,"sender":{"key":"jerry@skydio.com","avatar":"https://avatars.githubusercontent.com/u/81337184?v=4"},"body":"Replace OPT_VERBOSE with OPT_VERBOSITY.\n\nThis adds a --quiet flag to \"git apply\" so\nthe user can turn down the verbosity.\n\nSigned-off-by: Jerry Zhang <jerry@skydio.com>\n---\nV1->V2: rebase on master and rerun tests\n\n Documentation/git-apply.txt | 7 ++++++-\n apply.c                     | 2 +-\n 2 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt\nindex aa1ae56a25..a32ad64718 100644\n--- a/Documentation/git-apply.txt\n+++ b/Documentation/git-apply.txt\n@@ -16,7 +16,7 @@ SYNOPSIS\n \t  [--ignore-space-change | --ignore-whitespace]\n \t  [--whitespace=(nowarn|warn|fix|error|error-all)]\n \t  [--exclude=<path>] [--include=<path>] [--directory=<root>]\n-\t  [--verbose] [--unsafe-paths] [<patch>...]\n+\t  [--verbose | --quiet] [--unsafe-paths] [<patch>...]\n \n DESCRIPTION\n -----------\n@@ -228,6 +228,11 @@ behavior:\n \tcurrent patch being applied will be printed. This option will cause\n \tadditional information to be reported.\n \n+-q::\n+--quiet::\n+\tSuppress stderr output. Messages about patch status and progress\n+\twill not be printed.\n+\n --recount::\n \tDo not trust the line counts in the hunk headers, but infer them\n \tby inspecting the patch (e.g. after editing the patch without\ndiff --git a/apply.c b/apply.c\nindex fb321c707b..d530c3eb47 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -5051,7 +5051,7 @@ int apply_parse_options(int argc, const char **argv,\n \t\t\tN_(\"leave the rejected hunks in corresponding *.rej files\")),\n \t\tOPT_BOOL(0, \"allow-overlap\", &state->allow_overlap,\n \t\t\tN_(\"allow overlapping hunks\")),\n-\t\tOPT__VERBOSE(&state->apply_verbosity, N_(\"be verbose\")),\n+\t\tOPT__VERBOSITY(&state->apply_verbosity),\n \t\tOPT_BIT(0, \"inaccurate-eof\", options,\n \t\t\tN_(\"tolerate incorrectly detected missing new-line at the end of file\"),\n \t\t\tAPPLY_OPT_INACCURATE_EOF),\n-- \n2.32.0.1314.g6ed4fcc4cc\n\n"},{"id":"443855","messageId":"CAMKO5CvR2m6nvGXfqap=9w07Mw1p2Sgvw39dfhdJVU28K+ZCbg@mail.gmail.com","threadId":"55572","inReplyTo":"20210728032230.24611-1-jerry@skydio.com","subject":"Re: [PATCH V2] git-apply: add --quiet flag","fromName":"Jerry Zhang","fromEmail":"jerry@skydio.com","sentAt":"2021-12-11T02:07:55Z","receivedAt":"2021-12-11T02:08:08Z","isPatch":true,"sender":{"key":"jerry@skydio.com","avatar":"https://avatars.githubusercontent.com/u/81337184?v=4"},"body":"On Tue, Jul 27, 2021 at 8:22 PM Jerry Zhang <jerry@skydio.com> wrote:\n>\n> Replace OPT_VERBOSE with OPT_VERBOSITY.\n>\n> This adds a --quiet flag to \"git apply\" so\n> the user can turn down the verbosity.\n>\n> Signed-off-by: Jerry Zhang <jerry@skydio.com>\n> ---\n> V1->V2: rebase on master and rerun tests\n>\n>  Documentation/git-apply.txt | 7 ++++++-\n>  apply.c                     | 2 +-\n>  2 files changed, 7 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt\n> index aa1ae56a25..a32ad64718 100644\n> --- a/Documentation/git-apply.txt\n> +++ b/Documentation/git-apply.txt\n> @@ -16,7 +16,7 @@ SYNOPSIS\n>           [--ignore-space-change | --ignore-whitespace]\n>           [--whitespace=(nowarn|warn|fix|error|error-all)]\n>           [--exclude=<path>] [--include=<path>] [--directory=<root>]\n> -         [--verbose] [--unsafe-paths] [<patch>...]\n> +         [--verbose | --quiet] [--unsafe-paths] [<patch>...]\n>\n>  DESCRIPTION\n>  -----------\n> @@ -228,6 +228,11 @@ behavior:\n>         current patch being applied will be printed. This option will cause\n>         additional information to be reported.\n>\n> +-q::\n> +--quiet::\n> +       Suppress stderr output. Messages about patch status and progress\n> +       will not be printed.\n> +\n>  --recount::\n>         Do not trust the line counts in the hunk headers, but infer them\n>         by inspecting the patch (e.g. after editing the patch without\n> diff --git a/apply.c b/apply.c\n> index fb321c707b..d530c3eb47 100644\n> --- a/apply.c\n> +++ b/apply.c\n> @@ -5051,7 +5051,7 @@ int apply_parse_options(int argc, const char **argv,\n>                         N_(\"leave the rejected hunks in corresponding *.rej files\")),\n>                 OPT_BOOL(0, \"allow-overlap\", &state->allow_overlap,\n>                         N_(\"allow overlapping hunks\")),\n> -               OPT__VERBOSE(&state->apply_verbosity, N_(\"be verbose\")),\n> +               OPT__VERBOSITY(&state->apply_verbosity),\n>                 OPT_BIT(0, \"inaccurate-eof\", options,\n>                         N_(\"tolerate incorrectly detected missing new-line at the end of file\"),\n>                         APPLY_OPT_INACCURATE_EOF),\n> --\n> 2.32.0.1314.g6ed4fcc4cc\n>\nAny updates on this patch?\n"}]}