git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Derrick Stolee <dstolee@microsoft.com>
Subject: [RFC] Universal progress option (was Re: [PATCH] clone: use --quiet when stderr is not a terminal)
Date: Sun, 15 Mar 2020 09:41:39 -0400	[thread overview]
Message-ID: <310a176a-1b30-a479-638e-33a51fb2c896@gmail.com> (raw)
In-Reply-To: <a044478f-ca04-3475-90de-0332e80f552d@gmail.com>

On 3/15/2020 8:20 AM, Derrick Stolee wrote:
> And I was coming back to this thread shortly after waking up since
> I realized why the test fallout was bigger than I anticipated: this
> change shouldn't enable "--quiet" but instead "--no-progress". The
> loss of messages like "Cloning from ..." is actually a problematic
> behavior change.
> 
> I'll send a v2 using "--no-progress" instead.

...and then I find out that "git clone --no-progress" does not stop
the "Updating files" message because it does not pass the progress
option to that subsystem.

Please eject this patch for now, since "--quiet" is too aggressive
and "--no-progress" doesn't work.

...pause for change of topic...

After seeing too many of these "let's plumb the user-facing progress
option from the builtin into the underlying subsystem" patches, I have
half a mind to completely rework how we handle "--[no-]progress".

Here is a proposal for making the progress API easier to use, and
hopefully clean up our code around it:

1. Add a GIT_PROGRESS environment variable that is a boolean for
   showing progress or not.

2. Update Git's option-parsing to check for --[no-]progress in
   every builtin (before the builtins do their own parsing). If
   present, this overrides GIT_PROGRESS. Otherwise, if GIT_PROGRESS
   is unset, initialize GIT_PROGRESS to the opposite of isatty(2).

3. Update start_progress_delay() and start_progress() to return
   NULL if GIT_PROGRESS=0.

4. Refactor the callers of start_progress[_delay]() to call it
   unconditionally and remove the variables used in the old
   conditions.

While typically adding global state is undesirable, the current
mechanism of passing progress flags from builtins down to lower
layers (and adding --[no-]progress to subcommands) has shown to
be difficult to keep consistent and makes the rest of the code
messier.

I'm interested in pursuing this refactor, but only if the
community thinks it is a good idea. There are probably better
alternatives, too. Please let me know.

Thanks,
-Stolee

   

  reply	other threads:[~2020-03-15 13:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13 21:09 [PATCH] clone: use --quiet when stderr is not a terminal Derrick Stolee via GitGitGadget
2020-03-14 17:10 ` Junio C Hamano
2020-03-15 12:20   ` Derrick Stolee
2020-03-15 13:41     ` Derrick Stolee [this message]
2020-03-15 19:39       ` [RFC] Universal progress option (was Re: [PATCH] clone: use --quiet when stderr is not a terminal) Junio C Hamano
2020-03-15 23:59         ` Junio C Hamano
2020-03-16  0:27           ` Derrick Stolee
2020-03-14 19:16 ` [PATCH] clone: use --quiet when stderr is not a terminal Elijah Newren

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=310a176a-1b30-a479-638e-33a51fb2c896@gmail.com \
    --to=stolee@gmail.com \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.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).