Code

diff --stat: add config option to limit graph width
[git.git] / diff.c
diff --git a/diff.c b/diff.c
index 8f2abc8fe4b73590cbdecbaaa5cfe75eb1a4829c..4525cdadd805e018cfe158ea3e867ac882795a4f 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -31,6 +31,7 @@ static const char *external_diff_cmd_cfg;
 int diff_auto_refresh_index = 1;
 static int diff_mnemonic_prefix;
 static int diff_no_prefix;
+static int diff_stat_graph_width;
 static int diff_dirstat_permille_default = 30;
 static struct diff_options default_diff_options;
 
@@ -156,6 +157,10 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
                diff_no_prefix = git_config_bool(var, value);
                return 0;
        }
+       if (!strcmp(var, "diff.statgraphwidth")) {
+               diff_stat_graph_width = git_config_int(var, value);
+               return 0;
+       }
        if (!strcmp(var, "diff.external"))
                return git_config_string(&external_diff_cmd_cfg, var, value);
        if (!strcmp(var, "diff.wordregex"))
@@ -1398,6 +1403,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
        else
                width = options->stat_width ? options->stat_width : 80;
 
+       if (options->stat_graph_width == -1)
+               options->stat_graph_width = diff_stat_graph_width;
+
        /*
         * Guarantee 3/8*16==6 for the graph part
         * and 5/8*16==10 for the filename part