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

Re: [PATCH] Change 'Deltifying objects' to 'Delta compressing objects'

From
Shawn O. Pearce <spearce@spearce.org>
Date
Oct 19, 2007, 03:17 UTC
Message-ID
<20071019031737.GD14735@spearce.org>
In-Reply-To
<alpine.LFD.0.9999.0710182247130.19446@xanadu.home>
Nicolas Pitre <nico@cam.org> wrote:
Show 10 quoted lines
> On Thu, 18 Oct 2007, Shawn O. Pearce wrote:
> 
> > I really don't have an opinion either way.  Actually I think the
> > entire progress system of git-pack-objects should be reduced even
> > further so that users aren't exposed to the internal phases we
> > are going through.  Most of them just don't care.  They just
> > want to know when its going to be done[*1*].
> 
> Well, with my latest patches in that area, the typical progress on 
> screen has been cut in half.  And the different phases are intertaining.

Yup. Your patches were a big improvement. But I'm now sitting here wondering if we shouldn't just allow a progress meter to overwrite the prior one. Then you only see the current task and progress, or the final output if we have nothing further to say about that.

Hmmph.  Maybe something like this:

I like how it comes out in the end, but it really screws with the sideband protocol. Like horribly. I got a whole ton of "remote: remote: remote: remote: remote: remote:" during a remote clone.

diff --git a/progress.c b/progress.c
index 7629e05..099fc14 100644
--- a/progress.c
+++ b/progress.c
@@ -37,8 +37,6 @@ static void clear_progress_signal(void)
 
 static int display(struct progress *progress, unsigned n, int done)
 {
-	char *eol;
-
 	if (progress->delay) {
 		if (!progress_update || --progress->delay)
 			return 0;
@@ -55,18 +53,26 @@ static int display(struct progress *progress, unsigned n, int done)
 	}
 
 	progress->last_value = n;
-	eol = done ? ", done.   \n" : "   \r";
-	if (progress->total) {
+	if (done) {
+		size_t c = strlen(progress->title);
+		while (c--)
+			fputc(' ', stderr);
+		fputs("            ", stderr);
+		for (; n > 0; n /= 10)
+			fputs("  ", stderr);
+		fputc('\r', stderr);
+		return 1;
+	} else if (progress->total) {
 		unsigned percent = n * 100 / progress->total;
 		if (percent != progress->last_percent || progress_update) {
 			progress->last_percent = percent;
 			fprintf(stderr, "%s: %3u%% (%u/%u)%s", progress->title,
-				percent, n, progress->total, eol);
+				percent, n, progress->total, "   \r");
 			progress_update = 0;
 			return 1;
 		}
 	} else if (progress_update) {
-		fprintf(stderr, "%s: %u%s", progress->title, n, eol);
+		fprintf(stderr, "%s: %u%s", progress->title, n, "   \r");
 		progress_update = 0;
 		return 1;
 	}
-- 
Shawn.
Previous: Nicolas PitreNext: Nicolas Pitre
Message 28 of 38 in “Change 'Deltifying objects' to 'Delta compressing objects'”
  1. Change 'Deltifying objects' to 'Delta compressing objects'Shawn O. Pearce, Oct 19, 2007
  2. Jeff KingOct 19, 2007
  3. Sam VilainOct 19, 2007
  4. David SymondsOct 19, 2007
  5. Shawn O. PearceOct 19, 2007
  6. Nicolas PitreOct 19, 2007
  7. Jeff KingOct 19, 2007
  8. Sam VilainOct 19, 2007
  9. Jeff KingOct 19, 2007
  10. Shawn O. PearceOct 19, 2007
  11. Jeff KingOct 19, 2007
  12. Shawn O. PearceOct 19, 2007
  13. Nicolas PitreOct 19, 2007
  14. Jeff KingOct 19, 2007
  15. Nicolas PitreOct 19, 2007
  16. Jeff KingOct 19, 2007
  17. Nicolas PitreOct 19, 2007
  18. Jeff KingOct 19, 2007
  19. Linus TorvaldsOct 19, 2007
  20. Jeff KingOct 19, 2007
  21. Nicolas PitreOct 19, 2007
  22. Linus TorvaldsOct 19, 2007
  23. Linus TorvaldsOct 19, 2007
  24. Shawn O. PearceOct 19, 2007
  25. Shawn O. PearceOct 19, 2007
  26. Stop displaying "Pack pack-$ID created." during git-gcShawn O. Pearce, Oct 19, 2007
  27. Nicolas PitreOct 19, 2007
  28. Shawn O. PearceOct 19, 2007
  29. Nicolas PitreOct 19, 2007
  30. Jeff KingOct 19, 2007
  31. Shawn O. PearceOct 19, 2007
  32. Nicolas PitreOct 19, 2007
  33. Wincent ColaiutaOct 19, 2007
  34. Nicolas PitreOct 19, 2007
  35. Jeff KingOct 19, 2007
  36. Nicolas PitreOct 19, 2007
  37. Jeff KingOct 19, 2007
  38. Nicolas PitreOct 19, 2007

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.