summaryrefslogtreecommitdiff
path: root/color.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2007-12-11 06:27:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-12-11 08:42:05 (GMT)
commit6e9af863ee76423ec8416ad16140ef5f810783bf (patch)
tree147f4006c3c054d3777f704795b74e2d0574bfd7 /color.c
parent591aa2536fdbc4090ba8d4ca512d4ee7df4bf05d (diff)
downloadgit-6e9af863ee76423ec8416ad16140ef5f810783bf.zip
git-6e9af863ee76423ec8416ad16140ef5f810783bf.tar.gz
git-6e9af863ee76423ec8416ad16140ef5f810783bf.tar.bz2
Support GIT_PAGER_IN_USE environment variable
When deciding whether or not to turn on automatic color support, git_config_colorbool checks whether stdout is a tty. However, because we run a pager, if stdout is not a tty, we must check whether it is because we started the pager. This used to be done by checking the pager_in_use variable. This variable was set only when the git program being run started the pager; there was no way for an external program running git indicate that it had already started a pager. This patch allows a program to set GIT_PAGER_IN_USE to a true value to indicate that even though stdout is not a tty, it is because a pager is being used. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'color.c')
-rw-r--r--color.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/color.c b/color.c
index 7bd424a..7f66c29 100644
--- a/color.c
+++ b/color.c
@@ -135,7 +135,7 @@ int git_config_colorbool(const char *var, const char *value, int stdout_is_tty)
auto_color:
if (stdout_is_tty < 0)
stdout_is_tty = isatty(1);
- if (stdout_is_tty || (pager_in_use && pager_use_color)) {
+ if (stdout_is_tty || (pager_in_use() && pager_use_color)) {
char *term = getenv("TERM");
if (term && strcmp(term, "dumb"))
return 1;