git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] worktree: add --quiet option

From
Duy Nguyen <pclouds@gmail.com>
Date
Aug 7, 2018, 15:30 UTC
Message-ID
<CACsJy8A=zp7nFBuWyfeP4UFf3KSsiaor3m0mtgVnhcEYHSw4HA@mail.gmail.com>
In-Reply-To
<20180807132113.118297-1-gitter.spiros@gmail.com>
On Tue, Aug 7, 2018 at 3:27 PM Elia Pinto <gitter.spiros@gmail.com> wrote:
Show 22 quoted lines
>
> Add the '--quiet' option to git worktree add,
> as for the other git commands.
>
> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
> ---
>  Documentation/git-worktree.txt |  4 +++-
>  builtin/worktree.c             | 11 +++++++++--
>  2 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt
> index 9c26be40f..508cde55c 100644
> --- a/Documentation/git-worktree.txt
> +++ b/Documentation/git-worktree.txt
> @@ -115,7 +115,9 @@ Unlock a working tree, allowing it to be pruned, moved or deleted.
>
>  OPTIONS
>  -------
> -
> +-q::
> +--quiet::
> +       With 'add', suppress feedback messages.
Should we update the synopsis as well?
> @@ -315,6 +316,9 @@ static int add_worktree(const char *path, const char *refname,

Before here we run either update-ref or symbolic-ref. update-ref does not have --quiet so it's fine, no need to add another option there (until it shows something when used with "worktree add --quiet") but symbolic-ref seems to support -q. Should we pass -q to it?

Show 14 quoted lines
>                 cp.argv = NULL;
>                 argv_array_clear(&cp.args);
>                 argv_array_pushl(&cp.args, "reset", "--hard", NULL);
> +               if (opts->quiet)
> +                       argv_array_push(&cp.args, "--quiet");
> +               printf("%s\n","soo qia");
>                 cp.env = child_env.argv;
>                 ret = run_command(&cp);
>                 if (ret)
> @@ -437,6 +441,7 @@ static int add(int ac, const char **av, const char *prefix)
>                 OPT_BOOL(0, "detach", &opts.detach, N_("detach HEAD at named commit")),
>                 OPT_BOOL(0, "checkout", &opts.checkout, N_("populate the new working tree")),
>                 OPT_BOOL(0, "lock", &opts.keep_locked, N_("keep the new working tree locked")),
> +               OPT__QUIET(&opts.quiet, N_("suppress progress reporting")),

git grep OPT__QUIET shows that we have plenty different messages to describe --quiet. But yeah "support progress reporting" seems close enough in this context.

>                 OPT_PASSTHRU(0, "track", &opt_track, NULL,
>                              N_("set up tracking mode (see git-branch(1))"),
>                              PARSE_OPT_NOARG | PARSE_OPT_OPTARG),
The rest looks good.
-- 
Duy
Previous: Elia PintoNext: Eric Sunshine
Message 4 of 5 in “worktree: add --quiet option”
  1. worktree: add --quiet optionElia Pinto, Aug 7, 2018
  2. Martin ÅgrenAug 7, 2018
  3. Elia PintoAug 7, 2018
  4. Duy NguyenAug 7, 2018
  5. Eric SunshineAug 7, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.