Skip to content

Commit cbe0210

Browse files
dschogitster
authored andcommitted
Support config variable diff.external
We had the diff.external variable in the documentation of the config file since its conception, but failed to respect it. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f029427 commit cbe0210

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

diff.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
static int diff_detect_rename_default;
2121
static int diff_rename_limit_default = 100;
2222
static int diff_use_color_default;
23+
static const char *external_diff_cmd_cfg;
2324
int diff_auto_refresh_index = 1;
2425

2526
static char diff_colors[][COLOR_MAXLEN] = {
@@ -163,6 +164,10 @@ int git_diff_ui_config(const char *var, const char *value)
163164
diff_auto_refresh_index = git_config_bool(var, value);
164165
return 0;
165166
}
167+
if (!strcmp(var, "diff.external")) {
168+
external_diff_cmd_cfg = xstrdup(value);
169+
return 0;
170+
}
166171
if (!prefixcmp(var, "diff.")) {
167172
const char *ep = strrchr(var, '.');
168173

@@ -209,6 +214,8 @@ static const char *external_diff(void)
209214
if (done_preparing)
210215
return external_diff_cmd;
211216
external_diff_cmd = getenv("GIT_EXTERNAL_DIFF");
217+
if (!external_diff_cmd)
218+
external_diff_cmd = external_diff_cmd_cfg;
212219
done_preparing = 1;
213220
return external_diff_cmd;
214221
}

0 commit comments

Comments
 (0)