From: Junio C Hamano Date: Wed, 2 May 2012 20:53:28 +0000 (-0700) Subject: Merge branch 'zj/diff-stat-smaller-num-columns' X-Git-Tag: v1.7.11-rc0~67 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/29c2a3dbadaa1c2d1128a4892241f82f5b34778c Merge branch 'zj/diff-stat-smaller-num-columns' Spend only minimum number of columns necessary to show the number of lines in the output from "diff --stat", instead of always allocating 4 columns even when showing changes that are much smaller than 1000 lines. By Zbigniew Jędrzejewski-Szmek * zj/diff-stat-smaller-num-columns: diff --stat: use less columns for change counts --- 29c2a3dbadaa1c2d1128a4892241f82f5b34778c diff --cc diff.c index 7da16c9590,c316e0cbfb..02081d2af2 --- a/diff.c +++ b/diff.c @@@ -1509,9 -1530,11 +1530,11 @@@ static void show_stats(struct diffstat_ */ if (options->stat_width == -1) - width = term_columns(); + width = term_columns() - options->output_prefix_length; else width = options->stat_width ? options->stat_width : 80; + number_width = decimal_width(max_change) > number_width ? + decimal_width(max_change) : number_width; if (options->stat_graph_width == -1) options->stat_graph_width = diff_stat_graph_width;