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>
Johannes Schindelin committed
Dec 17, 2007 at 13:42 UTC
cbe021004fc8762076bf497cc0b259d110b3a753
1 file changed
+7
diff.c
+7
@@ -20,6 +20,7 @@
20
static int diff_detect_rename_default;
21
static int diff_rename_limit_default = 100;
22
static int diff_use_color_default;
23
+static const char *external_diff_cmd_cfg;
24
int diff_auto_refresh_index = 1;
25
26
static char diff_colors[][COLOR_MAXLEN] = {
@@ -163,6 +164,10 @@ int git_diff_ui_config(const char *var, const char *value)
164
diff_auto_refresh_index = git_config_bool(var, value);
165
return 0;
166
}
167
+ if (!strcmp(var, "diff.external")) {
168
+ external_diff_cmd_cfg = xstrdup(value);
169
+ return 0;
170
+ }
171
if (!prefixcmp(var, "diff.")) {
172
const char *ep = strrchr(var, '.');
173
@@ -209,6 +214,8 @@ static const char *external_diff(void)
214
if (done_preparing)
215
return external_diff_cmd;
216
external_diff_cmd = getenv("GIT_EXTERNAL_DIFF");
217
+ if (!external_diff_cmd)
218
+ external_diff_cmd = external_diff_cmd_cfg;
219
done_preparing = 1;
220
return external_diff_cmd;
221
}