summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-03-01 12:26:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-03-01 17:15:58 (GMT)
commitdf44483a5dde62f4b49c80fd90d7fe12ddcfb084 (patch)
tree10979081b6b5ec2e143e27841a6094db974dac14 /diff.c
parent969fe57b844a514747c1d5d66e0698dc53ed473d (diff)
downloadgit-df44483a5dde62f4b49c80fd90d7fe12ddcfb084.zip
git-df44483a5dde62f4b49c80fd90d7fe12ddcfb084.tar.gz
git-df44483a5dde62f4b49c80fd90d7fe12ddcfb084.tar.bz2
diff --stat: add config option to limit graph width
Config option diff.statGraphWidth=<width> is equivalent to --stat-graph-width=<width>, except that the config option is ignored by format-patch. For the graph-width limiting to be usable, it should happen 'automatically' once configured, hence the config option. Nevertheless, graph width limiting only makes sense when used on a wide terminal, so it should not influence the output of format-patch, which adheres to the 80-column standard. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 8f2abc8..4525cda 100644
--- 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