git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: how to suppress progress percentage in git-push

From
Jeff King <peff@peff.net>
Date
Nov 24, 2009, 03:07 UTC
Message-ID
<20091124030742.GA32029@coredump.intra.peff.net>
In-Reply-To
<20091124011339.GA18003@debian.b2j>
On Tue, Nov 24, 2009 at 09:13:39AM +0800, bill lam wrote:
Show 7 quoted lines
> On Mon, 23 Nov 2009, Nicolas Pitre wrote:
> > Then, during the pack-objects process, there are 3 phases: counting 
> > objects, compressing objects, and writing objects.  However in the fetch 
> 
> during git-gc it shows yet another progress 
> 
> Removing duplicate objects: 100% (256/256), done.

Thanks, this doesn't seem to have been guarded at all (but since it is on a 2-second delay, you have to have quite a lot of loose objects or a slow disk to trigger it).

We should apply the patch below to keep things consistent.

I also checked every other call to start_progress; everything else seems to be guarded. Most of them were easy to trace to an isatty check, though the one in unpack-trees is influenced by o->verbose_update. That in turn usually corresponds to a quiet option, though merge does seem to use it unconditionally. Maybe that should be tweaked, too?

-- >8 --
Subject: [PATCH] prune-packed: only show progress when stderr is a tty

This matches the behavior of other git programs, and helps keep cruft out of things like cron job output.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin-prune-packed.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-prune-packed.c b/builtin-prune-packed.c
index be99eb0..f9463de 100644
--- a/builtin-prune-packed.c
+++ b/builtin-prune-packed.c
@@ -71,7 +71,7 @@ void prune_packed_objects(int opts)
 
 int cmd_prune_packed(int argc, const char **argv, const char *prefix)
 {
-	int opts = VERBOSE;
+	int opts = isatty(2) ? VERBOSE : 0;
 	const struct option prune_packed_options[] = {
 		OPT_BIT('n', "dry-run", &opts, "dry run", DRY_RUN),
 		OPT_NEGBIT('q', "quiet", &opts, "be quiet", VERBOSE),
-- 
1.6.6.rc0.249.g9b4cf.dirty
Previous: bill lam
Message 16 of 16 in “how to suppress progress percentage in git-push”
  1. bill lamNov 22, 2009
  2. Jeff KingNov 23, 2009
  3. Petr BaudisNov 23, 2009
  4. Jeff KingNov 23, 2009
  5. Petr BaudisNov 23, 2009
  6. Jeff KingNov 23, 2009
  7. pack-objects: split implications of --all-progress from progress activationNicolas Pitre, Nov 23, 2009
  8. Petr BaudisNov 23, 2009
  9. Nicolas PitreNov 23, 2009
  10. Petr BaudisNov 23, 2009
  11. Jeff KingNov 23, 2009
  12. Nicolas PitreNov 23, 2009
  13. Jeff KingNov 23, 2009
  14. Nicolas PitreNov 23, 2009
  15. bill lamNov 24, 2009
  16. Jeff KingNov 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.