[0/5] Progress display fixes
mbox series

Message ID 20190325103844.26749-1-szeder.dev@gmail.com
Headers show
Series
  • Progress display fixes
Related show

Message

SZEDER Gábor March 25, 2019, 10:38 a.m. UTC
This patch series fixes two progress display issues:

  - When showing throughput, and the both the total and the throughput
    change units in the same update, than the previously shown
    progress bar is not cleaned up properly:

      Receiving objects:  25% (2901/11603), 772.01 KiB | 733.00 KiB/s
      Receiving objects:  27% (3133/11603), 1.43 MiB | 1.16 MiB/s   s

  - When the progress bar is longer than the width of the terminal,
    then we end up with a bunch of truncated progress bar lines
    scrolling past:

      $ LANG=es_ES.UTF-8 git commit-graph write
      Encontrando commits para commit graph entre los objetos empaquetados:   2% (1599
      Encontrando commits para commit graph entre los objetos empaquetados:   3% (1975
      Encontrando commits para commit graph entre los objetos empaquetados:   4% (2633
      Encontrando commits para commit graph entre los objetos empaquetados:   5% (3292
      [...]

Patches 4 and 5 fix these two issues, while the first three are
minor preparatory cleanups and refactorings.

SZEDER Gábor (5):
  progress: make display_progress() return void
  progress: return early when in the background
  progress: assemble percentage and counters in a strbuf before printing
  progress: clear previous progress update dynamically
  progress: break too long progress bar lines

 progress.c | 78 +++++++++++++++++++++++++++++++++++++++---------------
 progress.h |  2 +-
 2 files changed, 57 insertions(+), 23 deletions(-)

Comments

Jeff King March 26, 2019, 5:52 a.m. UTC | #1
On Mon, Mar 25, 2019 at 11:38:39AM +0100, SZEDER Gábor wrote:

> This patch series fixes two progress display issues:
> 
>   - When showing throughput, and the both the total and the throughput
>     change units in the same update, than the previously shown
>     progress bar is not cleaned up properly:
> 
>       Receiving objects:  25% (2901/11603), 772.01 KiB | 733.00 KiB/s
>       Receiving objects:  27% (3133/11603), 1.43 MiB | 1.16 MiB/s   s
> 
>   - When the progress bar is longer than the width of the terminal,
>     then we end up with a bunch of truncated progress bar lines
>     scrolling past:
> 
>       $ LANG=es_ES.UTF-8 git commit-graph write
>       Encontrando commits para commit graph entre los objetos empaquetados:   2% (1599
>       Encontrando commits para commit graph entre los objetos empaquetados:   3% (1975
>       Encontrando commits para commit graph entre los objetos empaquetados:   4% (2633
>       Encontrando commits para commit graph entre los objetos empaquetados:   5% (3292
>       [...]
> 
> Patches 4 and 5 fix these two issues, while the first three are
> minor preparatory cleanups and refactorings.

With the exception of the points raised in the thread, these look good
to me. Seeing your later patches, I think it would not be too bad to
just stick the is_foreground_fd() check inside the "if (update)" block
you introduce later.

-Peff