git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 30, 2018, 21:06 UTC
Message-ID
<20180530210641.19771-3-avarab@gmail.com>
In-Reply-To
<20180530210641.19771-1-avarab@gmail.com>

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 <avarab@gmail.com>
---
 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
Previous: Ævar Arnfjörð BjarmasonNext: Jeff King
Message 2 of 18 in “color.ui docs & add color.ui=isatty”
  1. 0/4 color.ui docs & add color.ui=isattyÆvar Arnfjörð Bjarmason, May 30, 2018
  2. 2/4 config doc: clarify "to a terminal" in color.uiÆvar Arnfjörð Bjarmason, May 30, 2018
  3. Jeff KingMay 31, 2018
  4. 3/4 color.ui config: don't die on unknown valuesÆvar Arnfjörð Bjarmason, May 30, 2018
  5. Stefan BellerMay 30, 2018
  6. Junio C HamanoMay 30, 2018
  7. Ævar Arnfjörð BjarmasonMay 31, 2018
  8. Jeff KingJun 1, 2018
  9. 1/4 config doc: move color.ui documentation to one placeÆvar Arnfjörð Bjarmason, May 30, 2018
  10. Jeff KingMay 31, 2018
  11. Ævar Arnfjörð BjarmasonMay 31, 2018
  12. Jeff KingJun 1, 2018
  13. 4/4 color.ui config: add "isatty" settingÆvar Arnfjörð Bjarmason, May 30, 2018
  14. Junio C HamanoMay 30, 2018
  15. Ævar Arnfjörð BjarmasonMay 31, 2018
  16. Jeff KingMay 31, 2018
  17. Ævar Arnfjörð BjarmasonMay 31, 2018
  18. Jeff KingJun 1, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.