Merge branch 'zj/diff-stat-smaller-num-columns'
authorJunio C Hamano <gitster@pobox.com>
Wed, 2 May 2012 20:53:28 +0000 (13:53 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 May 2012 20:53:28 +0000 (13:53 -0700)
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

1  2 
Documentation/gitcore-tutorial.txt
diff.c
t/t4052-stat-output.sh

Simple merge
diff --cc diff.c
index 7da16c9590805dc687d7dc67acac2cb104144036,c316e0cbfbb788a6e0066069c3425b1f712e543b..02081d2af249d7fef660bd401a6d508b2e21cff1
--- 1/diff.c
--- 2/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;
Simple merge