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

Re: [RFC PATCH] color: respect the $NO_COLOR convention

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 1, 2018, 19:06 UTC
Message-ID
<xmqq8tbbhayi.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<87efl3emlm.fsf@vuxu.org>
Leah Neukirchen <leah@vuxu.org> writes:
Show 6 quoted lines
> You are right in calling this out an emerging new thing, but the
> second list of that page proves that it will be useful to settle on a
> common configuration, and my hope is by getting a few popular projects
> on board, others will soon follow.  It certainly is easy to implement,
> and rather unintrusive.  Users which don't know about this feature are
> completely unaffected.

There certainly is chicken-and-egg problem there. Even though I personally prefer not to see overuse of colors, I am not sure if we the Git community as a whole would want to be involved until it gets mainstream.

Show 14 quoted lines
>>>  	if (color_stdout_is_tty < 0)
>>>  		color_stdout_is_tty = isatty(1);
>>>  	if (color_stdout_is_tty || (pager_in_use() && pager_use_color)) {
>>
>> According to no-color.org's FAQ #2, NO_COLOR should affect only the
>> "default" behaviour, and should stay back if there is an explicit
>> end-user configuration (or command line override).  And this helper
>> function is called only from want_color() when their is no such
>> higher precedence setting, which is in line with the recommendation.
>>
>> Which is good.
>
> Yes, I took care of that.  Should this also be tested?  It doesn't
> quite fit into the setting of t4026-color.sh I think.

It probably fits much better in t7006, I would suspect. Earlier, setting color.ui to auto meant the output is colored when run under test_terminal, but with this new environment set, the output will have to be bland.

Previous: Leah NeukirchenNext: brian m. carlson
Message 4 of 6 in “color: respect the $NO_COLOR convention”
  1. color: respect the $NO_COLOR conventionLeah Neukirchen, Mar 1, 2018
  2. Junio C HamanoMar 1, 2018
  3. Leah NeukirchenMar 1, 2018
  4. Junio C HamanoMar 1, 2018
  5. brian m. carlsonMar 4, 2018
  6. Junio C HamanoMar 5, 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.