summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--color.c10
-rw-r--r--color.h4
-rw-r--r--diff.c5
3 files changed, 16 insertions, 3 deletions
diff --git a/color.c b/color.c
index 8586417..ec96fe1 100644
--- a/color.c
+++ b/color.c
@@ -204,13 +204,21 @@ int want_color(int var)
return var > 0;
}
-int git_color_default_config(const char *var, const char *value, void *cb)
+int git_color_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "color.ui")) {
git_use_color_default = git_config_colorbool(var, value);
return 0;
}
+ return 0;
+}
+
+int git_color_default_config(const char *var, const char *value, void *cb)
+{
+ if (git_color_config(var, value, cb) < 0)
+ return -1;
+
return git_default_config(var, value, cb);
}
diff --git a/color.h b/color.h
index b413e0e..3e515f2 100644
--- a/color.h
+++ b/color.h
@@ -74,8 +74,10 @@ extern const int column_colors_ansi_max;
extern int color_stdout_is_tty;
/*
- * Use this instead of git_default_config if you need the value of color.ui.
+ * Use the first one if you need only color config; the second is a convenience
+ * if you are just going to change to git_default_config, too.
*/
+int git_color_config(const char *var, const char *value, void *cb);
int git_color_default_config(const char *var, const char *value, void *cb);
int git_config_colorbool(const char *var, const char *value);
diff --git a/diff.c b/diff.c
index 0496cdc..052e42a 100644
--- a/diff.c
+++ b/diff.c
@@ -164,6 +164,9 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
if (!strcmp(var, "diff.ignoresubmodules"))
handle_ignore_submodules_arg(&default_diff_options, value);
+ if (git_color_config(var, value, cb) < 0)
+ return -1;
+
return git_diff_basic_config(var, value, cb);
}
@@ -212,7 +215,7 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
if (!prefixcmp(var, "submodule."))
return parse_submodule_config_option(var, value);
- return git_color_default_config(var, value, cb);
+ return git_default_config(var, value, cb);
}
static char *quote_two(const char *one, const char *two)