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

Re: [PATCH 1/6] more compact progress display

From
Shawn O. Pearce <spearce@spearce.org>
Date
Oct 17, 2007, 02:11 UTC
Message-ID
<20071017021137.GO13801@spearce.org>
In-Reply-To
<1192586150-13743-2-git-send-email-nico@cam.org>
Nicolas Pitre <nico@cam.org> wrote:
> Each progress can be on a single line instead of two.
Nice.  Of course that screws with git-gui and now I have to
match two regexs and not one.  But whatever.
 
Show 25 quoted lines
> +++ b/progress.c
> @@ -35,10 +35,11 @@ static void clear_progress_signal(void)
>  	progress_update = 0;
>  }
>  
> -int display_progress(struct progress *progress, unsigned n)
> +static int display(struct progress *progress, unsigned n, int done)
>  {
> +	char *eol;
> +
>  	if (progress->delay) {
> -		char buf[80];
>  		if (!progress_update || --progress->delay)
>  			return 0;
>  		if (progress->total) {
> @@ -51,60 +52,56 @@ int display_progress(struct progress *progress, unsigned n)
>  				return 0;
>  			}
>  		}
> -		if (snprintf(buf, sizeof(buf),
> -			     progress->delayed_title, progress->total))
> -			fprintf(stderr, "%s\n", buf);
>  	}
> +
> +	progress->last_value = n;

Hmm. n is unsigned and last_value is signed. Uh? I know you are using the special value -1 to mean we've never output anything for this progress meter but mixing signed and unsigned always gives me the willies.

-- 
Shawn.
Previous: Nicolas PitreNext: Nicolas Pitre
Message 10 of 17 in “miscelaneous stuff”
  1. 0/6 miscelaneous stuffNicolas Pitre, Oct 17, 2007
  2. 1/6 more compact progress displayNicolas Pitre, Oct 17, 2007
  3. 2/6 cope with multiple line breaks within sideband progress messagesNicolas Pitre, Oct 17, 2007
  4. 3/6 pack-objects: no delta possible with only one object in the listNicolas Pitre, Oct 17, 2007
  5. 4/6 pack-objects.c: fix some global variable abuse and memory leaksNicolas Pitre, Oct 17, 2007
  6. 5/6 fix const issues with some functionsNicolas Pitre, Oct 17, 2007
  7. 6/6 fix for more minor memory leaksNicolas Pitre, Oct 17, 2007
  8. Deltifying? (was [PATCH 3/6] pack-objects: no delta possible...)Shawn O. Pearce, Oct 17, 2007
  9. Nicolas PitreOct 17, 2007
  10. Shawn O. PearceOct 17, 2007
  11. Nicolas PitreOct 17, 2007
  12. Karl HasselströmOct 17, 2007
  13. Nicolas PitreOct 17, 2007
  14. Shawn O. PearceOct 18, 2007
  15. Karl HasselströmOct 18, 2007
  16. Johannes SixtOct 17, 2007
  17. Shawn O. PearceOct 17, 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.