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

Re: [PATCH] checkout: be quiet if not on isatty()

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 28, 2011, 06:22 UTC
Message-ID
<7vaaau9hso.fsf@alter.siamese.dyndns.org>
In-Reply-To
<c70a246a601bec0ce973b177bf5553d3fee47014.1314472512.git.sdaoden@gmail.com>
Steffen Daode Nurpmeso <sdaoden@googlemail.com> writes:
> Signed-off-by: Steffen Daode Nurpmeso <sdaoden@gmail.com>
Justification is necessary why this is a good change.
Perhaps you meant something like this:
	In general, the progress output should not be given unless the
        output is sent to a tty (i.e. an interactive session).

But this patch may be squelching the output a bit too much. The opts.quiet field is used not just to set verbose_update in the unpack_trees_options used in reset_tree() and merge_working_tree(), but also used to report the local changes at the end of merge_working_tree(), report tracking information, and report where the detached HEAD is at, among other things.

Independently, it might make sense to squelch advice messages in a non-interactive session, but I think that should probably be done by flipping advice_* variables in advice.c, I think.

Show 16 quoted lines
> ---
>  builtin/checkout.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 4eaedff..6fb6d48 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -958,6 +958,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
>  	gitmodules_config();
>  	git_config(git_checkout_config, &opts);
>  
> +	opts.quiet = !isatty(2);
>  	opts.track = BRANCH_TRACK_UNSPECIFIED;
>  
>  	argc = parse_options(argc, argv, prefix, options, checkout_usage,
Previous: Steffen Daode NurpmesoNext: martin f krafft
Message 14 of 21 in “progress: use \r as EOL only if isatty(stderr) is true”
  1. progress: use \r as EOL only if isatty(stderr) is trueSteffen Daode Nurpmeso, Jun 28, 2011
  2. Junio C HamanoJun 28, 2011
  3. Steffen Daode NurpmesoJun 28, 2011
  4. Steffen Daode NurpmesoJun 28, 2011
  5. Jeff KingJun 28, 2011
  6. Junio C HamanoJun 29, 2011
  7. Miles BaderJun 30, 2011
  8. sideband: remove line padding (was: Re: [PATCH] progress: use \r as EOL only if isatty(stderr) is true)Steffen Daode Nurpmeso, Jun 29, 2011
  9. Nicolas PitreJun 29, 2011
  10. Steffen Daode NurpmesoJun 30, 2011
  11. Nicolas PitreJul 1, 2011
  12. checkout: be quiet if not on isatty()Steffen Daode Nurpmeso, Aug 27, 2011
  13. checkout: be quiet if not on isatty()Steffen Daode Nurpmeso, Aug 27, 2011
  14. Junio C HamanoAug 28, 2011
  15. martin f krafftAug 28, 2011
  16. checkout: add --verbose, and restrict progress reporting (was: Re: [PATCH] checkout: be quiet if not on isatty())Steffen Daode Nurpmeso, Aug 28, 2011
  17. 0/2 Add update_progress(), divert checkout messagessdaoden@googlemail.com, Aug 29, 2011
  18. 1/2 progress: add update_progress()sdaoden@googlemail.com, Aug 29, 2011
  19. 2/2 unpack-trees: divert check_updates() output via update_progress()sdaoden@googlemail.com, Aug 29, 2011
  20. Steffen Daode NurpmesoJun 28, 2011
  21. Steffen Daode NurpmesoJun 28, 2011

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.