From: ZheNing Hu <adlternative@gmail.com>
To: Derrick Stolee <derrickstolee@github.com>
Cc: ZheNing Hu via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <johannes.schindelin@gmx.de>,
Victoria Dye <vdye@github.com>
Subject: Re: [PATCH] scalar: use verbose mode in clone
Date: Wed, 14 Dec 2022 00:37:06 +0800 [thread overview]
Message-ID: <CAOLTT8TBtWAoN+etO_tDezN0e5yP1hSSzKn20SqvfDE-0o3pQQ@mail.gmail.com> (raw)
In-Reply-To: <95e92f84-5f83-6439-0d02-f8060669a4d3@github.com>
Hi,
Derrick Stolee <derrickstolee@github.com> 于2022年12月9日周五 00:30写道:
>
> On 12/7/2022 1:10 PM, ZheNing Hu via GitGitGadget wrote:
> > From: ZheNing Hu <adlternative@gmail.com>
> >
> > 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.
>
Good point that we should care about atty.
I guess you mean is to add a parameter to run_git(), which can
control if git commands show stderr/stdout... This solution
may be better. Because git checkout should also have the
same behavior as git fetch: quiet or verbose.
> Also, I'm not sure your implementation is doing the right
> thing.
>
> > - 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.
>
Sorry, but I don't understand: I deleted "--quiet", and the progress bar can
also be displayed. Why do you say "not change the way we are
calling 'git fetch'"?
> You might want to add the "--progress" option in the verbose
> case.
>
Good advice.
> As Taylor mentioned, a test might be helpful. Here's an
> example from t7700-repack.sh 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
> '
>
Thanks for the reminder, I will pay attention to this "TTY" and
"GIT_PROGRESS_DELAY" when I write tests later.
> Thanks,
> -Stolee
Thanks,
-ZheNing Hu
next prev parent reply other threads:[~2022-12-13 16:37 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
2022-12-13 16:37 ` ZheNing Hu [this message]
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOLTT8TBtWAoN+etO_tDezN0e5yP1hSSzKn20SqvfDE-0o3pQQ@mail.gmail.com \
--to=adlternative@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
--cc=vdye@github.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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
https://80x24.org/mirrors/git.git
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).