{"thread":{"id":"49061","subject":"[PATCH] worktree: add --quiet option","startedAt":"2018-08-07T13:21:21Z","lastAt":"2018-08-07T19:13:00Z","messageCount":5,"participants":["Elia Pinto","Martin Ågren","Duy Nguyen","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"354730","messageId":"20180807132113.118297-1-gitter.spiros@gmail.com","threadId":"49061","inReplyTo":null,"subject":"[PATCH] worktree: add --quiet option","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2018-08-07T13:21:13Z","receivedAt":"2018-08-07T13:21:21Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"Add the '--quiet' option to git worktree add,\nas for the other git commands.\n\nSigned-off-by: Elia Pinto <gitter.spiros@gmail.com>\n---\n Documentation/git-worktree.txt |  4 +++-\n builtin/worktree.c             | 11 +++++++++--\n 2 files changed, 12 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt\nindex 9c26be40f..508cde55c 100644\n--- a/Documentation/git-worktree.txt\n+++ b/Documentation/git-worktree.txt\n@@ -115,7 +115,9 @@ Unlock a working tree, allowing it to be pruned, moved or deleted.\n \n OPTIONS\n -------\n-\n+-q::\n+--quiet::\n+\tWith 'add', suppress feedback messages.\n -f::\n --force::\n \tBy default, `add` refuses to create a new working tree when\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex a763dbdcc..c47feb4a4 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -27,6 +27,7 @@ static const char * const worktree_usage[] = {\n struct add_opts {\n \tint force;\n \tint detach;\n+\tint quiet;\n \tint checkout;\n \tint keep_locked;\n };\n@@ -315,6 +316,9 @@ static int add_worktree(const char *path, const char *refname,\n \t\tcp.argv = NULL;\n \t\targv_array_clear(&cp.args);\n \t\targv_array_pushl(&cp.args, \"reset\", \"--hard\", NULL);\n+\t\tif (opts->quiet)\n+\t\t\targv_array_push(&cp.args, \"--quiet\");\n+\t\tprintf(\"%s\\n\",\"soo qia\");\n \t\tcp.env = child_env.argv;\n \t\tret = run_command(&cp);\n \t\tif (ret)\n@@ -437,6 +441,7 @@ static int add(int ac, const char **av, const char *prefix)\n \t\tOPT_BOOL(0, \"detach\", &opts.detach, N_(\"detach HEAD at named commit\")),\n \t\tOPT_BOOL(0, \"checkout\", &opts.checkout, N_(\"populate the new working tree\")),\n \t\tOPT_BOOL(0, \"lock\", &opts.keep_locked, N_(\"keep the new working tree locked\")),\n+\t\tOPT__QUIET(&opts.quiet, N_(\"suppress progress reporting\")),\n \t\tOPT_PASSTHRU(0, \"track\", &opt_track, NULL,\n \t\t\t     N_(\"set up tracking mode (see git-branch(1))\"),\n \t\t\t     PARSE_OPT_NOARG | PARSE_OPT_OPTARG),\n@@ -491,8 +496,8 @@ static int add(int ac, const char **av, const char *prefix)\n \t\t\t}\n \t\t}\n \t}\n-\n-\tprint_preparing_worktree_line(opts.detach, branch, new_branch, !!new_branch_force);\n+\tif (!opts.quiet)\n+\t\tprint_preparing_worktree_line(opts.detach, branch, new_branch, !!new_branch_force);\n \n \tif (new_branch) {\n \t\tstruct child_process cp = CHILD_PROCESS_INIT;\n@@ -500,6 +505,8 @@ static int add(int ac, const char **av, const char *prefix)\n \t\targv_array_push(&cp.args, \"branch\");\n \t\tif (new_branch_force)\n \t\t\targv_array_push(&cp.args, \"--force\");\n+\t\tif (opts.quiet)\n+\t\t\targv_array_push(&cp.args, \"--quiet\");\n \t\targv_array_push(&cp.args, new_branch);\n \t\targv_array_push(&cp.args, branch);\n \t\tif (opt_track)\n-- \n2.18.0.721.gc1f18ed\n\n"},{"id":"354740","messageId":"CAN0heSrsHNnZoMFF+v+Fc_Ketk3fnQsnM=BuYVwkT5DPRjHsLw@mail.gmail.com","threadId":"49061","inReplyTo":"20180807132113.118297-1-gitter.spiros@gmail.com","subject":"Re: [PATCH] worktree: add --quiet option","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2018-08-07T14:37:01Z","receivedAt":"2018-08-07T14:37:03Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"Hi Elia\n\nOn 7 August 2018 at 15:21, Elia Pinto <gitter.spiros@gmail.com> wrote:\n> Add the '--quiet' option to git worktree add,\n> as for the other git commands.\n>\n> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>\n> ---\n>  Documentation/git-worktree.txt |  4 +++-\n>  builtin/worktree.c             | 11 +++++++++--\n>  2 files changed, 12 insertions(+), 3 deletions(-)\n>\n> diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt\n> index 9c26be40f..508cde55c 100644\n> --- a/Documentation/git-worktree.txt\n> +++ b/Documentation/git-worktree.txt\n> @@ -115,7 +115,9 @@ Unlock a working tree, allowing it to be pruned, moved or deleted.\n>\n>  OPTIONS\n>  -------\n> -\n\nGrepping through Documentation/, it is clear that we sometimes have a\nblank line here, sometimes not. I'm not sure what to make of that.\n\n> +-q::\n> +--quiet::\n> +       With 'add', suppress feedback messages.\n>  -f::\n\nBut I do think that for consistency, we'd prefer a blank line before `-f::`.\n\nBoth the commit message and this documentation makes me wonder if this\nfocuses on \"add\" because it's the only subcommand where `--quiet` makes\nsense, conceptually, or because this is where you happen to need it\npersonally, or due to some other $reason. Could you say something more\nabout this?\n\nI'm not a worktree power-user, so please forgive my ignorance...\n\n> @@ -315,6 +316,9 @@ static int add_worktree(const char *path, const char *refname,\n>                 cp.argv = NULL;\n>                 argv_array_clear(&cp.args);\n>                 argv_array_pushl(&cp.args, \"reset\", \"--hard\", NULL);\n> +               if (opts->quiet)\n> +                       argv_array_push(&cp.args, \"--quiet\");\n> +               printf(\"%s\\n\",\"soo qia\");\n\nThis last line looks like debug cruft.\n\n> @@ -437,6 +441,7 @@ static int add(int ac, const char **av, const char *prefix)\n>                 OPT_BOOL(0, \"detach\", &opts.detach, N_(\"detach HEAD at named commit\")),\n>                 OPT_BOOL(0, \"checkout\", &opts.checkout, N_(\"populate the new working tree\")),\n>                 OPT_BOOL(0, \"lock\", &opts.keep_locked, N_(\"keep the new working tree locked\")),\n> +               OPT__QUIET(&opts.quiet, N_(\"suppress progress reporting\")),\n\nThis matches other users. Good.\n\nI did some simple testing and this appears to be quite quiet, modulo\nthe \"soo qia\" that I already mentioned. Could you add a test to\ndemonstrate the quietness and to keep it from regressing? Something like\n`git worktree add ../foo >out && test_must_be_empty out\" in e.g.,\nt2025-worktree-add.sh might do the trick (capture stderr as well?).\n\nHope this helps\nMartin\n"},{"id":"354743","messageId":"CACsJy8A=zp7nFBuWyfeP4UFf3KSsiaor3m0mtgVnhcEYHSw4HA@mail.gmail.com","threadId":"49061","inReplyTo":"20180807132113.118297-1-gitter.spiros@gmail.com","subject":"Re: [PATCH] worktree: add --quiet option","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-08-07T15:30:04Z","receivedAt":"2018-08-07T15:30:35Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Aug 7, 2018 at 3:27 PM Elia Pinto <gitter.spiros@gmail.com> wrote:\n>\n> Add the '--quiet' option to git worktree add,\n> as for the other git commands.\n>\n> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>\n> ---\n>  Documentation/git-worktree.txt |  4 +++-\n>  builtin/worktree.c             | 11 +++++++++--\n>  2 files changed, 12 insertions(+), 3 deletions(-)\n>\n> diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt\n> index 9c26be40f..508cde55c 100644\n> --- a/Documentation/git-worktree.txt\n> +++ b/Documentation/git-worktree.txt\n> @@ -115,7 +115,9 @@ Unlock a working tree, allowing it to be pruned, moved or deleted.\n>\n>  OPTIONS\n>  -------\n> -\n> +-q::\n> +--quiet::\n> +       With 'add', suppress feedback messages.\n\nShould we update the synopsis as well?\n\n> @@ -315,6 +316,9 @@ static int add_worktree(const char *path, const char *refname,\n\nBefore here we run either update-ref or symbolic-ref. update-ref does\nnot have --quiet so it's fine, no need to add another option there\n(until it shows something when used with \"worktree add --quiet\") but\nsymbolic-ref seems to support -q. Should we pass -q to it?\n\n>                 cp.argv = NULL;\n>                 argv_array_clear(&cp.args);\n>                 argv_array_pushl(&cp.args, \"reset\", \"--hard\", NULL);\n> +               if (opts->quiet)\n> +                       argv_array_push(&cp.args, \"--quiet\");\n> +               printf(\"%s\\n\",\"soo qia\");\n>                 cp.env = child_env.argv;\n>                 ret = run_command(&cp);\n>                 if (ret)\n> @@ -437,6 +441,7 @@ static int add(int ac, const char **av, const char *prefix)\n>                 OPT_BOOL(0, \"detach\", &opts.detach, N_(\"detach HEAD at named commit\")),\n>                 OPT_BOOL(0, \"checkout\", &opts.checkout, N_(\"populate the new working tree\")),\n>                 OPT_BOOL(0, \"lock\", &opts.keep_locked, N_(\"keep the new working tree locked\")),\n> +               OPT__QUIET(&opts.quiet, N_(\"suppress progress reporting\")),\n\ngit grep OPT__QUIET shows that we have plenty different messages to\ndescribe --quiet. But yeah \"support progress reporting\" seems close\nenough in this context.\n\n>                 OPT_PASSTHRU(0, \"track\", &opt_track, NULL,\n>                              N_(\"set up tracking mode (see git-branch(1))\"),\n>                              PARSE_OPT_NOARG | PARSE_OPT_OPTARG),\n\nThe rest looks good.\n-- \nDuy\n"},{"id":"354745","messageId":"CA+EOSBmA_147s=ON3UMiQ=aN_7uy2TYQvcsU-qOnF9UtiyyiQQ@mail.gmail.com","threadId":"49061","inReplyTo":"CAN0heSrsHNnZoMFF+v+Fc_Ketk3fnQsnM=BuYVwkT5DPRjHsLw@mail.gmail.com","subject":"Re: [PATCH] worktree: add --quiet option","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2018-08-07T15:46:13Z","receivedAt":"2018-08-07T15:46:18Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"2018-08-07 16:37 GMT+02:00 Martin Ågren <martin.agren@gmail.com>:\n> Hi Elia\n>\n> On 7 August 2018 at 15:21, Elia Pinto <gitter.spiros@gmail.com> wrote:\n>> Add the '--quiet' option to git worktree add,\n>> as for the other git commands.\n>>\n>> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>\n>> ---\n>>  Documentation/git-worktree.txt |  4 +++-\n>>  builtin/worktree.c             | 11 +++++++++--\n>>  2 files changed, 12 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt\n>> index 9c26be40f..508cde55c 100644\n>> --- a/Documentation/git-worktree.txt\n>> +++ b/Documentation/git-worktree.txt\n>> @@ -115,7 +115,9 @@ Unlock a working tree, allowing it to be pruned, moved or deleted.\n>>\n>>  OPTIONS\n>>  -------\n>> -\n>\n> Grepping through Documentation/, it is clear that we sometimes have a\n> blank line here, sometimes not. I'm not sure what to make of that.\n>\n>> +-q::\n>> +--quiet::\n>> +       With 'add', suppress feedback messages.\n>>  -f::\n>\n> But I do think that for consistency, we'd prefer a blank line before `-f::`.\n>\n> Both the commit message and this documentation makes me wonder if this\n> focuses on \"add\" because it's the only subcommand where `--quiet` makes\n> sense, conceptually, or because this is where you happen to need it\n> personally, or due to some other $reason. Could you say something more\n> about this?\n>\n> I'm not a worktree power-user, so please forgive my ignorance...\n>\n>> @@ -315,6 +316,9 @@ static int add_worktree(const char *path, const char *refname,\n>>                 cp.argv = NULL;\n>>                 argv_array_clear(&cp.args);\n>>                 argv_array_pushl(&cp.args, \"reset\", \"--hard\", NULL);\n>> +               if (opts->quiet)\n>> +                       argv_array_push(&cp.args, \"--quiet\");\n>> +               printf(\"%s\\n\",\"soo qia\");\n>\n> This last line looks like debug cruft.\n>\n>> @@ -437,6 +441,7 @@ static int add(int ac, const char **av, const char *prefix)\n>>                 OPT_BOOL(0, \"detach\", &opts.detach, N_(\"detach HEAD at named commit\")),\n>>                 OPT_BOOL(0, \"checkout\", &opts.checkout, N_(\"populate the new working tree\")),\n>>                 OPT_BOOL(0, \"lock\", &opts.keep_locked, N_(\"keep the new working tree locked\")),\n>> +               OPT__QUIET(&opts.quiet, N_(\"suppress progress reporting\")),\n>\n> This matches other users. Good.\n>\n> I did some simple testing and this appears to be quite quiet, modulo\n> the \"soo qia\" that I already mentioned. Could you add a test to\n> demonstrate the quietness and to keep it from regressing? Something like\n> `git worktree add ../foo >out && test_must_be_empty out\" in e.g.,\n> t2025-worktree-add.sh might do the trick (capture stderr as well?).\n>\n> Hope this helps\n> Martin\n\n\nThank you all. sorry for the trash in the patch I will resend it.\n"},{"id":"354764","messageId":"CAPig+cS-b2yL2FeLRzS+jW-O5fRd1g8Kqak7j1QX5PRP0ojQEQ@mail.gmail.com","threadId":"49061","inReplyTo":"20180807132113.118297-1-gitter.spiros@gmail.com","subject":"Re: [PATCH] worktree: add --quiet option","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-08-07T19:12:46Z","receivedAt":"2018-08-07T19:13:00Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"(cc:+Karen Arutyunov[1]; perhaps also do so when you re-roll)\n\nIn addition to the good review comments by Martin and Duy...\n\nOn Tue, Aug 7, 2018 at 9:21 AM Elia Pinto <gitter.spiros@gmail.com> wrote:\n> Add the '--quiet' option to git worktree add,\n> as for the other git commands.\n\nIt might make sense to say instead that this is adding a --quiet\noption _in general_, rather than doing so specifically for 'add'.\nThen, go on to say that, at present, 'add' is the only command\naffected by it since all other commands are currently silent by\ndefault (except, of course, 'list').\n\nWhether you like that idea or not, as Martin suggested, please do say\nsomething in the commit message about why the other commands don't\nneed it.\n\n> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>\n> ---\n> diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt\n> @@ -115,7 +115,9 @@ Unlock a working tree, allowing it to be pruned, moved or deleted.\n>  OPTIONS\n>  -------\n> -\n> +-q::\n> +--quiet::\n> +       With 'add', suppress feedback messages.\n>  -f::\n>  --force::\n\nIn addition to the blank-line issues Martin raised, please move this\nhunk downward to be a neighbor of the --verbose option.\n\nREFERENCES\n[1]: https://public-inbox.org/git/02659385-334f-2b77-c9a8-ffea8e461b0b@codesynthesis.com/\n"}]}