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

Re: [PATCH] reduce progress updates in background

From
Nicolas Pitre <nico@fluxnic.net>
Date
Apr 13, 2015, 14:11 UTC
Message-ID
<alpine.LFD.2.11.1504130954420.5619@knanqh.ubzr>
In-Reply-To
<20150413134850.GC23475@mewburn.net>
On Mon, 13 Apr 2015, Luke Mewburn wrote:
Show 31 quoted lines
> Hi,
> 
> I've noticed that when a long-running git operation that generates
> progress output is suspended and converted to a background process,
> the terminal still gets spammed with progress updates (to stderr).
> 
> Many years ago I fixed a similar issue in the NetBSD ftp progress
> bar code (which I wrote).
> 
> I've experimented around with a couple of different solutions, including:
> 1. suppress all progress output whilst in the background
> 2. suppress "in progress" updates whilst in the background,
>    but display the "done" message even if in the background.
> 
> In both cases, warnings were still output to the terminal.
> 
> I've attached a patch that implements (2) above.
> 
> If the consensus is that all progress messages should be suppressed,
> I can provide the (simpler) patch for that.
> 
> I've explicitly separated the in_progress_fd() function
> so that it's easier to (a) reuse elsewhere where appropriate,
> and (b) make any portability changes to the test if necessary.
> I also used getpgid(0) versus getpgrp() to avoid portability
> issues with the signature in the latter with pre-POSIX.
> 
> A minor optimisation could be to pass in struct progress *
> and to cache getpgid(0) in a member of struct progress
> in start_progress_delay(), since this value shouldn't change
> during the life of the process.

What if you suspend the task and push it into the background? Would be nice to inhibit progress display in that case, and resume it if the task returns to the foreground.

Also the display() function may be called quite a lot without necessarily resulting in a display output. Therefore I'd suggest adding in_progress_fd() to the if condition right before the printf() instead.

Nicolas
Previous: Luke MewburnNext: Luke Mewburn
Message 2 of 20 in “reduce progress updates in background”
  1. reduce progress updates in backgroundLuke Mewburn, Apr 13, 2015
  2. Nicolas PitreApr 13, 2015
  3. Luke MewburnApr 13, 2015
  4. Nicolas PitreApr 13, 2015
  5. reduce progress updates in backgroundLuke Mewburn, Apr 14, 2015
  6. Nicolas PitreApr 14, 2015
  7. compat/mingw: stubs for getpgid() and tcgetpgrp()Johannes Sixt, Apr 15, 2015
  8. Junio C HamanoApr 15, 2015
  9. Johannes SixtApr 15, 2015
  10. Johannes SchindelinApr 16, 2015
  11. Junio C HamanoApr 16, 2015
  12. Erik Faye-LundApr 15, 2015
  13. Johannes SchindelinApr 16, 2015
  14. rupert thurnerApr 23, 2015
  15. rupert thurnerApr 24, 2015
  16. Johannes SchindelinApr 24, 2015
  17. Luke MewburnApr 17, 2015
  18. Luke MewburnApr 14, 2015
  19. brian m. carlsonApr 14, 2015
  20. Johannes SchindelinApr 14, 2015

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.