summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorVegard Nossum <vegard.nossum@oracle.com>2017-01-12 12:21:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-12 20:55:43 (GMT)
commitc488867793dc9b273c1d35746452d44afcd3d7f5 (patch)
tree2aaada4e2834794bd322cc698c5c9856564ad3bf /diff.c
parentd7dffce1cebde29a0c4b309a79e4345450bf352a (diff)
downloadgit-c488867793dc9b273c1d35746452d44afcd3d7f5.zip
git-c488867793dc9b273c1d35746452d44afcd3d7f5.tar.gz
git-c488867793dc9b273c1d35746452d44afcd3d7f5.tar.bz2
diff: add interhunk context config option
The --inter-hunk-context= option was added in commit 6d0e674a5754 ("diff: add option to show context between close hunks"). This patch allows configuring a default for this option. Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> 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 e2eb6d6..f08cd8e 100644
--- a/diff.c
+++ b/diff.c
@@ -32,6 +32,7 @@ static int diff_rename_limit_default = 400;
static int diff_suppress_blank_empty;
static int diff_use_color_default = -1;
static int diff_context_default = 3;
+static int diff_interhunk_context_default;
static const char *diff_word_regex_cfg;
static const char *external_diff_cmd_cfg;
static const char *diff_order_file_cfg;
@@ -239,6 +240,12 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
return -1;
return 0;
}
+ if (!strcmp(var, "diff.interhunkcontext")) {
+ diff_interhunk_context_default = git_config_int(var, value);
+ if (diff_interhunk_context_default < 0)
+ return -1;
+ return 0;
+ }
if (!strcmp(var, "diff.renames")) {
diff_detect_rename_default = git_config_rename(var, value);
return 0;
@@ -3362,6 +3369,7 @@ void diff_setup(struct diff_options *options)
options->rename_limit = -1;
options->dirstat_permille = diff_dirstat_permille_default;
options->context = diff_context_default;
+ options->interhunkcontext = diff_interhunk_context_default;
options->ws_error_highlight = ws_error_highlight_default;
DIFF_OPT_SET(options, RENAME_EMPTY);