path: root/color.h
diff options
authorJeff King <>2011-08-18 05:05:08 (GMT)
committerJunio C Hamano <>2011-08-19 22:51:38 (GMT)
commit3e1dd17a8958cc5fe47a7ca01c9da8f6fae9cb0b (patch)
tree3549f30edb6b8730423b37b29336936a9c8d22de /color.h
parentc659f55b31bb928688afd4ddfd94f8bea978ff1a (diff)
diff: don't load color config in plumbing
The diff config callback is split into two functions: one which loads "ui" config, and one which loads "basic" config. The former chains to the latter, as the diff UI config is a superset of the plumbing config. The color.diff variable is only loaded in the UI config. However, the basic config actually chains to git_color_default_config, which loads color.ui. This doesn't actually cause any bugs, because the plumbing diff code does not actually look at the value of color.ui. However, it is somewhat nonsensical, and it makes it difficult to refactor the color code. It probably came about because there is no git_color_config to load only color config, but rather just git_color_default_config, which loads color config and chains to git_default_config. This patch splits out the color-specific portion of git_color_default_config so that the diff UI config can call it directly. This is perhaps better explained by the chaining of callbacks. Before we had: git_diff_ui_config -> git_diff_basic_config -> git_color_default_config -> git_default_config Now we have: git_diff_ui_config -> git_color_config -> git_diff_basic_config -> git_default_config Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'color.h')
1 files changed, 3 insertions, 1 deletions
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);