path: root/color.h
diff options
authorJeff King <>2011-08-18 05:03:48 (GMT)
committerJunio C Hamano <>2011-08-18 21:48:29 (GMT)
commite269eb7946d0a4ba6a4e175133b5479446ac04a5 (patch)
tree65da98cebb4776458fa7944ba7101c2f4149f1f7 /color.h
parentf1c9626105d5e4962a5ccaa4620114d03f32ad02 (diff)
git_config_colorbool: refactor stdout_is_tty handling
Usually this function figures out for itself whether stdout is a tty. However, it has an extra parameter just to allow git-config to override the auto-detection for its --get-colorbool option. Instead of an extra parameter, let's just use a global variable. This makes calling easier in the common case, and will make refactoring the colorbool code much simpler. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'color.h')
1 files changed, 7 insertions, 1 deletions
diff --git a/color.h b/color.h
index 68a926a..a190a25 100644
--- a/color.h
+++ b/color.h
@@ -58,11 +58,17 @@ extern const char *column_colors_ansi[];
extern const int column_colors_ansi_max;
+ * Generally the color code will lazily figure this out itself, but
+ * this provides a mechanism for callers to override autodetection.
+ */
+extern int color_stdout_is_tty;
* Use this instead of git_default_config if you need the value of color.ui.
int git_color_default_config(const char *var, const char *value, void *cb);
-int git_config_colorbool(const char *var, const char *value, int stdout_is_tty);
+int git_config_colorbool(const char *var, const char *value);
void color_parse(const char *value, const char *var, char *dst);
void color_parse_mem(const char *value, int len, const char *var, char *dst);
__attribute__((format (printf, 3, 4)))