Subject: [PATCH 2/4] config doc: clarify "to a terminal" in color.ui

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Wed, 30 May 2018 21:06:39 +0000

Change the documentation added when color.ui=auto was made the default
in 4c7f1819b3 ("make color.ui default to 'auto'", 2013-06-10) to
describe "auto" as kicking in when writing to the terminal or a pager,
not just to the terminal.

I had someone ask me why it was that git was writing colors with
color.ui=auto in situations where isatty(3) would return 0. The
existing documentation about that would have been true before
85fb65ed6e (""git -p cmd" to page anywhere", 2006-06-06), but since
then "auto" has always used a heuristic that isn't quite what isatty()
would return, rather it checks if we're connected to a TTY or if we're
about to emit to a pager, trusting that the pager can handle color
output.

Instead we have the color.pager variable introduced in
aa086eb813 ("pager: config variable pager.color", 2006-07-30) to
explicitly disable color output to the pager. Let's change the
documentation to reflect this.

Signed-off-by: Ævar Arnfjörð Bjarmason <[email-masked]>
---
 Documentation/config.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 44735dd88e..4767363519 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1288,7 +1288,9 @@ color.ui::
 	or the `--color` option. Set it to `always` if you want all
 	output not intended for machine consumption to use color, to
 	`true` or `auto` (this is the default since Git 1.8.4) if you
-	want such output to use color when written to the terminal.
+	want such output to use color when written to the terminal (as
+	determined by a call to `isatty(3)`) or to a pager (unless
+	`color.pager` is set to false).
 
 column.ui::
 	Specify whether supported commands should output in columns.
-- 
2.17.0.290.gded63e768a