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

Re: [PATCH] format_commit_message: honor `color=auto` for `%C(auto)`

From
Jeff King <peff@peff.net>
Date
May 27, 2016, 03:55 UTC
Message-ID
<20160527035553.GA24972@sigill.intra.peff.net>
In-Reply-To
<20160527034610.GA31629@zoidberg>
On Thu, May 26, 2016 at 10:46:10PM -0500, Edward Thomson wrote:
Show 19 quoted lines
> git-log(1) documents that when specifying the `%C(auto)` format
> placeholder will "turn on auto coloring on the next %placeholders
> until the color is switched again."
> 
> However, when `%C(auto)` is used, the present implementation will turn
> colors on unconditionally (even if the color configuration is turned off
> for the current context - for example, `--no-color` was specified or the
> color is `auto` and the output is not a tty).
> 
> Update `format_commit_one` to examine the current context when a format
> string of `%C(auto)` is specified, which ensures that we will not
> unconditionally write colors.  This brings that behavior in line with
> the behavior of `%C(auto,<colorname>)`, and allows the user the ability
> to specify that color should be displayed only when the output is a
> tty.
> 
> Additionally, add a test for `%C(auto)` and update the existing tests
> for `%C(auto,...)` as they were misidentified as being applicable to
> `%C(auto)`.
Explanation and the patch look good.
Show 5 quoted lines
> Signed-off-by: Edward Thomson <ethomson@edwardthomson.com>
> 
> Tests from Jeff King.
> 
> Signed-off-by: Jeff King <peff@peff.net>

Trailers should all go at the bottom in a single stanza, and should generally be in chronological order (so you got the bits from with an s-o-b, and then you signed off the whole thing). IOW:

> Tests from Jeff King.
>
> Signed-off-by: Jeff King <peff@peff.net>
> Signed-off-by: Edward Thomson <ethomson@edwardthomson.com>

I suspect Junio can just tweak that while applying, unless there's another reason to re-roll.

(Also for anybody watching, Ed did not just make up my signoff; I gave it to him off-list).

-Peff
Previous: Edward ThomsonNext: Junio C Hamano
Message 2 of 3 in “format_commit_message: honor `color=auto` for `%C(auto)`”
  1. format_commit_message: honor `color=auto` for `%C(auto)`Edward Thomson, May 27, 2016
  2. Jeff KingMay 27, 2016
  3. Junio C HamanoMay 27, 2016

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.