From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: "Felipe Contreras" <felipe.contreras@gmail.com>,
git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Randall S. Becker" <rsbecker@nexbridge.com>
Subject: Re: [PATCH] help: colorize man pages
Date: Wed, 19 May 2021 10:08:54 +0900 [thread overview]
Message-ID: <xmqqfsyj1qe1.fsf@gitster.g> (raw)
In-Reply-To: <YKRSlFcFAcHcR3uY@camp.crustytoothpaste.net> (brian m. carlson's message of "Tue, 18 May 2021 23:49:40 +0000")
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
> In general, this is made worse because Git doesn't honor the unofficial
> but widely supported NO_COLOR[0], so reading the documentation is
> obligatory.
I vaguely recall that we were contacted by NO_COLOR folks to be
an early supporter of their cause to break the chicken-and-egg
problem they were hagving, and (unhelpfully) answered with "sure,
when we see enough people support it---otherwise we'd end up having
to keep essentially a dead code that supports a convention that is
not all that useful".
> [0] https://no-color.org/
I wonderr if it is just a matter of hooking into want_color(), like this?
color.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git c/color.c w/color.c
index 64f52a4f93..2516ef7275 100644
--- c/color.c
+++ w/color.c
@@ -373,12 +373,17 @@ int want_color_fd(int fd, int var)
* we always write the same value, but it's still wrong. This function
* is listed in .tsan-suppressions for the time being.
*/
-
+ static int no_color = -1;
static int want_auto[3] = { -1, -1, -1 };
if (fd < 1 || fd >= ARRAY_SIZE(want_auto))
BUG("file descriptor out of range: %d", fd);
+ if (no_color < 0)
+ no_color = !!getenv("NO_COLOR");
+ if (no_color)
+ return 0;
+
if (var < 0)
var = git_use_color_default;
next prev parent reply other threads:[~2021-05-19 1:08 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 1:01 [PATCH] help: colorize man pages Felipe Contreras
2021-05-18 1:19 ` brian m. carlson
2021-05-18 3:22 ` Felipe Contreras
2021-05-18 23:49 ` brian m. carlson
2021-05-19 1:08 ` Junio C Hamano [this message]
2021-05-19 2:07 ` brian m. carlson
2021-05-19 6:09 ` Junio C Hamano
2021-05-19 8:41 ` Ævar Arnfjörð Bjarmason
2021-05-19 10:36 ` Felipe Contreras
2021-05-21 0:58 ` brian m. carlson
2021-05-21 18:09 ` Felipe Contreras
2021-05-21 19:48 ` Igor Djordjevic
2021-05-21 21:20 ` Felipe Contreras
2021-05-21 22:10 ` Igor Djordjevic
2021-05-21 23:04 ` Felipe Contreras
2021-05-22 18:38 ` Igor Djordjevic
2021-05-22 21:48 ` Felipe Contreras
2021-05-23 11:25 ` Igor Djordjevic
2021-05-23 14:48 ` Felipe Contreras
2021-05-21 22:47 ` Igor Djordjevic
2021-05-21 23:32 ` Junio C Hamano
2021-05-19 9:26 ` Ævar Arnfjörð Bjarmason
2021-05-19 10:10 ` Jeff King
2021-05-19 11:45 ` Felipe Contreras
2021-05-19 11:19 ` Felipe Contreras
2021-05-19 12:21 ` Felipe Contreras
2021-05-20 1:55 ` brian m. carlson
2021-05-20 2:23 ` Junio C Hamano
2021-05-20 3:05 ` Felipe Contreras
2021-05-20 3:28 ` Junio C Hamano
2021-05-20 3:48 ` Felipe Contreras
2021-05-20 2:45 ` Felipe Contreras
2021-05-19 10:25 ` Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfsyj1qe1.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=rsbecker@nexbridge.com \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).