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

Re: %C(auto) not working as expected

From
Duy Nguyen <pclouds@gmail.com>
Date
Oct 10, 2016, 09:26 UTC
Message-ID
<CACsJy8CroyynVMctbPhuVr2VVQB7YyfcxDaMT25BikQ4R4We0Q@mail.gmail.com>
In-Reply-To
<20161009234617.y6xfjyv6xjkf2afi@sigill.intra.peff.net>
On Mon, Oct 10, 2016 at 6:46 AM, Jeff King <peff@peff.net> wrote:
Show 5 quoted lines
> On Sun, Oct 09, 2016 at 03:24:17PM +0200, René Scharfe wrote:
>
>> Offering a way to enable terminal-detection for all color codes of a
>> format would be useful, but using the existing "auto," prefix for that
>> would be a behaviour change that could surprise users.

I wonder if we made a mistake associating terminal-detection with %C(auto,...). The more likely use case is enable or disable all colors, not "the next tag".

Show 11 quoted lines
> Yeah. In retrospect, it probably would have been saner to make %C(red) a
> noop when --color is not in effect (either because of --no-color, or
> more likely when --color=auto is in effect and stdout is not a
> terminal). But that ship has long since sailed, I think.
>
> If we do a revamp of the pretty-formats to bring them more in line with
> ref-filter (e.g., something like "%(color:red)") maybe that would be an
> opportunity to make minor adjustments. Though, hmm, it looks like
> for-each-ref already knows "%(color:red)", and it's unconditional.
> <sigh> So perhaps we would need to go through some deprecation period or
> other transition.

We could add some new tag to change the behavior of all following %C tags. Something like %C(tty) maybe (probably a bad name), then discourage the use if "%C(auto" for terminal detection?

-- 
Duy
Previous: Jeff KingNext: Jeff King
Message 6 of 23 in “%C(auto) not working as expected”
  1. Tom HaleOct 9, 2016
  2. René ScharfeOct 9, 2016
  3. Tom HaleOct 9, 2016
  4. René ScharfeOct 9, 2016
  5. Jeff KingOct 9, 2016
  6. Duy NguyenOct 10, 2016
  7. Jeff KingOct 10, 2016
  8. pretty: respect color settings for %C placeholdersJeff King, Oct 10, 2016
  9. René ScharfeOct 10, 2016
  10. Jeff KingOct 10, 2016
  11. René ScharfeOct 10, 2016
  12. Jeff KingOct 10, 2016
  13. Junio C HamanoOct 10, 2016
  14. Jeff KingOct 10, 2016
  15. Jeff KingOct 10, 2016
  16. Duy NguyenOct 11, 2016
  17. Duy NguyenOct 25, 2016
  18. Jeff KingOct 25, 2016
  19. Duy NguyenOct 25, 2016
  20. René ScharfeOct 10, 2016
  21. Jeff KingOct 10, 2016
  22. pretty: fix document link for color specificationRené Scharfe, Oct 11, 2016
  23. Jeff KingOct 11, 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.