mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <>
To: ZheNing Hu via GitGitGadget <>,
Cc: Junio C Hamano <>,
	Johannes Schindelin <>,
	Victoria Dye <>,
	ZheNing Hu <>
Subject: Re: [PATCH] scalar: use verbose mode in clone
Date: Thu, 8 Dec 2022 11:30:04 -0500	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 12/7/2022 1:10 PM, ZheNing Hu via GitGitGadget wrote:
> From: ZheNing Hu <>
> Sometimes when users use scalar to download a monorepo
> with a long commit history, they want to check the
> progress bar to know how long they still need to wait
> during the fetch process, but scalar suppresses this
> output by default.

I think this is an accurate description of the status quo.
> So add `[--verbose| -v]` to scalar clone, to enable
> fetch's output.

However, this isn't the only thing we could consider doing.

For instance, we typically use isatty(2) to detect if
stderr is a terminal to determine if we should carry
through progress indicators. It seems that maybe run_git()
is not passing through stderr and thus diminishing the
progress indicators to the fetch subprocess. It's worth
looking into to see if there's a different approach that
would get the same goal without needing a new option. It
could also make your proposed '--verbose' to be implied
by isatty(2).

If being verbose becomes the implied default with isatty(2),
then it might be better to add a --quiet option instead, to
opt-out of the progress.

Also, I'm not sure your implementation is doing the right

> -	if ((res = run_git("fetch", "--quiet", "origin", NULL))) {
> +	if ((res = run_git("fetch", "origin",
> +			   verbosity ? NULL : "--quiet",
> +			   NULL))) {
>  		warning(_("partial clone failed; attempting full clone"));
>  		if (set_config("remote.origin.promisor") ||
> @@ -508,7 +511,9 @@ static int cmd_clone(int argc, const char **argv)
>  			goto cleanup;
>  		}
> -		if ((res = run_git("fetch", "--quiet", "origin", NULL)))
> +		if ((res = run_git("fetch", "origin",
> +				   verbosity ? NULL : "--quiet",
> +				   NULL)))

Specifically, here the "verbosity" being on does not change
the way we are calling 'git fetch', so I do not expect the
behavior to change with this calling pattern.

You might want to add the "--progress" option in the verbose

As Taylor mentioned, a test might be helpful. Here's an
example from that sets up the isatty(2)
configuration correctly, as well as sets the progress
delay to 0 to be sure some progress indicators are written:

test_expect_success TTY '--quiet disables progress' '
	test_terminal env GIT_PROGRESS_DELAY=0 \
		git -C midx repack -ad --quiet --write-midx 2>stderr &&
	test_must_be_empty stderr


  parent reply	other threads:[~2022-12-08 16:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 18:10 [PATCH] scalar: use verbose mode in clone ZheNing Hu via GitGitGadget
2022-12-07 22:10 ` Taylor Blau
2022-12-08 15:54   ` ZheNing Hu
2022-12-08 16:30 ` Derrick Stolee [this message]
2022-12-13 16:37   ` ZheNing Hu
2022-12-25 13:29 ` [PATCH v2] scalar: show progress if stderr refer to a terminal ZheNing Hu via GitGitGadget
2023-01-05 19:19   ` Derrick Stolee
2023-01-06 12:30     ` Junio C Hamano
2023-01-11 11:59     ` ZheNing Hu
2023-01-11 13:14   ` [PATCH v3] " ZheNing Hu via GitGitGadget
2023-01-11 14:55     ` Derrick Stolee
2023-01-13 19:52       ` Junio C Hamano

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:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \

* 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.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).