From e269eb7946d0a4ba6a4e175133b5479446ac04a5 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 17 Aug 2011 22:03:48 -0700 Subject: 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 --- color.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'color.h') diff --git a/color.h b/color.h index 68a926a2cd..a190a2522b 100644 --- a/color.h +++ b/color.h @@ -57,12 +57,18 @@ extern int git_use_color_default; 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))) -- cgit v1.2.3