Merge branch 'sg/overlong-progress-fix'
authorJunio C Hamano <gitster@pobox.com>
Thu, 25 Apr 2019 07:41:19 +0000 (16:41 +0900)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Apr 2019 07:41:19 +0000 (16:41 +0900)
Updating the display with progress message has been cleaned up to
deal better with overlong messages.

* sg/overlong-progress-fix:
progress: break too long progress bar lines
progress: clear previous progress update dynamically
progress: assemble percentage and counters in a strbuf before printing
progress: make display_progress() return void

1  2 
progress.c
progress.h
diff --cc progress.c
index 212d00e524819aafe17b55f1b2f54a5bcf40dd7e,2d8022a6223e2e79ba087efaf0354fd16bdccd63..6cde5959fac75ab2640f11346dd124c962d98067
@@@ -34,9 -35,11 +35,12 @@@ struct progress 
        uint64_t total;
        unsigned last_percent;
        unsigned delay;
 +      unsigned sparse;
        struct throughput *throughput;
        uint64_t start_ns;
+       struct strbuf counters_sb;
+       int title_len;
+       int split;
  };
  
  static volatile sig_atomic_t progress_update;
@@@ -209,9 -236,11 +237,12 @@@ static struct progress *start_progress_
        progress->last_value = -1;
        progress->last_percent = -1;
        progress->delay = delay;
 +      progress->sparse = sparse;
        progress->throughput = NULL;
        progress->start_ns = getnanotime();
+       strbuf_init(&progress->counters_sb, 0);
+       progress->title_len = utf8_strwidth(title);
+       progress->split = 0;
        set_progress_signal();
        return progress;
  }
diff --cc progress.h
index 7b725acc8d7b6cbaa5e36743b42b29d8c22d868d,59e40cc4fd003ec6037ef11e5f2270bfd28054f0..847338911fbb6cf359f39ea0cb7a406297b61812
@@@ -4,12 -4,9 +4,12 @@@
  struct progress;
  
  void display_throughput(struct progress *progress, uint64_t total);
int display_progress(struct progress *progress, uint64_t n);
void display_progress(struct progress *progress, uint64_t n);
  struct progress *start_progress(const char *title, uint64_t total);
 +struct progress *start_sparse_progress(const char *title, uint64_t total);
  struct progress *start_delayed_progress(const char *title, uint64_t total);
 +struct progress *start_delayed_sparse_progress(const char *title,
 +                                             uint64_t total);
  void stop_progress(struct progress **progress);
  void stop_progress_msg(struct progress **progress, const char *msg);