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>, Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH v2] scalar: show progress if stderr refer to a terminal
Date: Wed, 11 Jan 2023 19:59:31 +0800 [thread overview]
Message-ID: <CAOLTT8Q6sOkDLm7pnkJ6e7mi4MDu6PYKD6vSd0NZbO9qAWkFmw@mail.gmail.com> (raw)
In-Reply-To: <1f8493b0-3f96-c616-1e4e-98b6ed33e8c4@github.com>
Derrick Stolee <derrickstolee@github.com> 于2023年1月6日周五 03:19写道:
>
> On 12/25/22 8:29 AM, ZheNing Hu via GitGitGadget wrote:
> > From: ZheNing Hu <adlternative@gmail.com>
>
> Sorry for the long wait in getting back to reviewing.
>
Ah, It's okay.
> > 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.
> >
> > So let's check whether scalar stderr refer to a terminal,
> > if so, show progress, otherwise disable it.
>
> Thanks for updating to this strategy. I think it's an
> easier change to swallow. We can consider options like
> --progress, --verbose, or --quiet later while this
> change does the good work of showing terminal users
> helpful progress.
>
Yes, but I think something like `--quiet` is difficult to implement.
We cannot just add `--no-progress` or `--quiet` to the git checkout
for suppressing the progress. Because git checkout will not use it
to suppress the fetch progress, but only the checkout's progress.
> > + int full_clone = 0, single_branch = 0, show_progress = isatty(2);
>
> > - if ((res = run_git("fetch", "--quiet", "origin", NULL))) {
> > + if ((res = run_git("fetch", "--quiet",
> > + show_progress ? "--progress" : "--no-progress",
> > + "origin", NULL))) {
> > warning(_("partial clone failed; attempting full clone"));
> >
> > if (set_config("remote.origin.promisor") ||
> > @@ -508,7 +510,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", "--quiet",
> > + show_progress ? "--progress" : "--no-progress",
> > + "origin", NULL)))
> Implementation looks correct.
>
> > +test_expect_success TTY 'progress with tty' '
> > + enlistment=progress1 &&
> > +
> > + test_config -C to-clone uploadpack.allowfilter true &&
> > + test_config -C to-clone uploadpack.allowanysha1inwant true &&
> > +
> > + test_terminal env GIT_PROGRESS_DELAY=0 \
> > + scalar clone "file://$(pwd)/to-clone" "$enlistment" 2>stderr &&
>
> Thank you for creating this test!
>
> > + grep --count "Enumerating objects" stderr >actual &&
> > + echo 2 >expected &&
> > + test_cmp expected actual &&
>
> I think you could use "test_line_count = 2 actual" here.
>
Oh, good suggestion. I should also use grep without `--count` too.
> > + cleanup_clone $enlistment
> > +'
> > +
> > +test_expect_success 'progress without tty' '
> > + enlistment=progress2 &&
> > +
> > + test_config -C to-clone uploadpack.allowfilter true &&
> > + test_config -C to-clone uploadpack.allowanysha1inwant true &&
> > +
> > + scalar clone "file://$(pwd)/to-clone" "$enlistment" 2>stderr &&
> > + ! grep "Enumerating objects" stderr &&
> > + ! grep "Updating files" stderr &&
>
> Here, it would be good to still have the GIT_PROGRESS_DELAY=0
> environment variable on the 'scalar clone' command to be sure
> we are not getting these lines because progress is turned off
> and not because it's running too quickly.
>
OK, that makes sense.
> > + cleanup_clone $enlistment
> > +'
> > test_done
>
> A nit: there should be an empty line between the end quote of
> the last test and "test_done".
>
> Thanks,
> -Stolee
Thanks,
-ZheNing Hu
next prev parent reply other threads:[~2023-01-11 12:03 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
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 [this message]
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=CAOLTT8Q6sOkDLm7pnkJ6e7mi4MDu6PYKD6vSd0NZbO9qAWkFmw@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=me@ttaylorr.com \
--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).