All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, ryenus@gmail.com, stolee@gmail.com,
	Derrick Stolee <dstolee@microsoft.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v3 1/2] progress: create GIT_PROGRESS_DELAY
Date: Thu, 7 Nov 2019 16:22:35 -0500	[thread overview]
Message-ID: <20191107212235.GB29042@sigill.intra.peff.net> (raw)
In-Reply-To: <656dba5afb818d0caa7616d0e58c9728803f8d04.1573148818.git.gitgitgadget@gmail.com>

On Thu, Nov 07, 2019 at 05:46:57PM +0000, Derrick Stolee via GitGitGadget wrote:

> From: Derrick Stolee <dstolee@microsoft.com>
> 
> The start_delayed_progress() method is a preferred way to show
> optional progress to users as it ignores steps that take less
> than two seconds. However, this makes testing unreliable as tests
> expect to be very fast.
> 
> In addition, users may want to decrease or increase this time
> interval depending on their preferences for terminal noise.
> 
> Create the GIT_PROGRESS_DELAY environment variable to control
> the delay set during start_delayed_progress(). Set the value
> in some tests to guarantee their output remains consistent.

Thanks for wrapping this up. I obviously think this is a good direction
to go. :) A few thoughts:

> diff --git a/Documentation/git.txt b/Documentation/git.txt
> index 9b82564d1a..1c420da208 100644
> --- a/Documentation/git.txt
> +++ b/Documentation/git.txt
> @@ -544,6 +544,10 @@ other
>  	a pager.  See also the `core.pager` option in
>  	linkgit:git-config[1].
>  
> +`GIT_PROGRESS_DELAY`::
> +	A number controlling how many seconds to delay before showing
> +	optional progress indicators. Defaults to 2.

Not all progress meters use delay. I wonder if that might confuse some
users, who would try:

  GIT_PROGRESS_DELAY=10 git repack -ad

or something, but still see "Enumerating objects".

I guess the key word in your documentation is "optional", but maybe it
needs to be spelled out more clearly. I dunno.

> @@ -269,7 +270,12 @@ static struct progress *start_progress_delay(const char *title, uint64_t total,
>  
>  struct progress *start_delayed_progress(const char *title, uint64_t total)
>  {
> -	return start_progress_delay(title, total, 2, 0);
> +	static int delay_in_secs = -1;
> +
> +	if (delay_in_secs < 0)
> +		delay_in_secs = git_env_ulong("GIT_PROGRESS_DELAY", 2);
> +
> +	return start_progress_delay(title, total, delay_in_secs, 0);
>  }

You asked earlier if it was worth memo-izing the git_env_ulong() call
like this. I suspect it doesn't matter much either way, since progress
only starts and stops a few times in a given program. But I'm certainly
happy with it this way, as it matches most other environment lookups.

-Peff

  reply	other threads:[~2019-11-07 21:22 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 16:05 [PATCH 0/1] commit-graph: use start_delayed_progress() Derrick Stolee via GitGitGadget
2019-11-05 16:05 ` [PATCH 1/1] " Derrick Stolee via GitGitGadget
2019-11-05 17:38   ` Derrick Stolee
2019-11-05 20:14 ` [PATCH v2 0/1] " Derrick Stolee via GitGitGadget
2019-11-05 20:14   ` [PATCH v2 1/1] " Derrick Stolee via GitGitGadget
2019-11-06  4:09     ` Jeff King
2019-11-06 13:21       ` Derrick Stolee
2019-11-07  6:40         ` Jeff King
2019-11-07 13:30           ` Derrick Stolee
2019-11-07  4:37       ` Junio C Hamano
2019-11-07  6:43         ` Jeff King
2019-11-07  9:51           ` Junio C Hamano
2019-11-07 17:46   ` [PATCH v3 0/2] " Derrick Stolee via GitGitGadget
2019-11-07 17:46     ` [PATCH v3 1/2] progress: create GIT_PROGRESS_DELAY Derrick Stolee via GitGitGadget
2019-11-07 21:22       ` Jeff King [this message]
2019-11-11 14:27       ` SZEDER Gábor
2019-11-07 17:46     ` [PATCH v3 2/2] commit-graph: use start_delayed_progress() Derrick Stolee via GitGitGadget
2019-11-07 21:26       ` Jeff King
2019-11-21 23:03         ` SZEDER Gábor
2019-11-21 15:51     ` [PATCH v4 0/2] " Derrick Stolee via GitGitGadget
2019-11-21 15:51       ` [PATCH v4 1/2] progress: create GIT_PROGRESS_DELAY Derrick Stolee via GitGitGadget
2019-11-22  7:15         ` Jeff King
2019-11-21 15:51       ` [PATCH v4 2/2] commit-graph: use start_delayed_progress() Derrick Stolee via GitGitGadget
2019-11-22  7:17         ` Jeff King
2019-11-25 18:57           ` Derrick Stolee
2019-11-25 21:28       ` [PATCH v5 0/2] " Derrick Stolee via GitGitGadget
2019-11-25 21:28         ` [PATCH v5 1/2] progress: create GIT_PROGRESS_DELAY Derrick Stolee via GitGitGadget
2019-11-25 21:28         ` [PATCH v5 2/2] commit-graph: use start_delayed_progress() Derrick Stolee via GitGitGadget
2019-11-26 12:20         ` [PATCH v5 0/2] " Jeff King
2019-11-26 15:39           ` Derrick Stolee
2019-11-30 14:36             ` Junio C Hamano
2019-12-01  9:33               ` SZEDER Gábor

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

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

  git send-email \
    --in-reply-to=20191107212235.GB29042@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=ryenus@gmail.com \
    --cc=stolee@gmail.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.