diff options
author | Jeff King <peff@peff.net> | 2011-08-18 07:03:48 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-18 23:48:29 +0200 |
commit | e269eb7946d0a4ba6a4e175133b5479446ac04a5 (patch) | |
tree | 65da98cebb4776458fa7944ba7101c2f4149f1f7 /color.h | |
parent | diff: refactor COLOR_DIFF from a flag into an int (diff) | |
download | git-e269eb7946d0a4ba6a4e175133b5479446ac04a5.tar.xz git-e269eb7946d0a4ba6a4e175133b5479446ac04a5.zip |
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r-- | color.h | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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))) |