From: Junio C Hamano Date: Thu, 25 Apr 2019 07:41:19 +0000 (+0900) Subject: Merge branch 'sg/overlong-progress-fix' X-Git-Tag: v2.22.0-rc0~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=425e51e54d03a510904b9bb10b43a7635f2d085f;p=git Merge branch 'sg/overlong-progress-fix' 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 --- 425e51e54d03a510904b9bb10b43a7635f2d085f diff --cc progress.c index 212d00e524,2d8022a622..6cde5959fa --- a/progress.c +++ b/progress.c @@@ -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 7b725acc8d,59e40cc4fd..847338911f --- a/progress.h +++ b/progress.h @@@ -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);