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

Re: Pretty format color bug

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 21, 2022, 23:29 UTC
Message-ID
<220222.865yp7aj6z.gmgdl@evledraar.gmail.com>
In-Reply-To
<b5b7cb21-30a9-32b8-cadd-1a768f5b98b2@pdev.de>
Show 6 quoted lines
> I think I found a minor formatting bug when using the custom pretty format:
>
> * What did you do before the bug happened? (Steps to reproduce your issue)
> git log --pretty=format:'%h%Cred%+d test'
> [...]
> In case of ref names / a second line, the color is missing completely.

I think you've found a "bug" or unexpected feature, but it's not in git, but in your pager.

Try:
    PAGER=cat git log --pretty=format:'%h%Cred%+d test'

I'm assuming you're using "less" and are about to read about its behavior of resetting colors that are still in effect when it hits a newline.

I hope that helps.
Previous: Raphael BauerNext: Raphael Bauer
Message 2 of 11 in “Pretty format color bug”
  1. Raphael BauerFeb 21, 2022
  2. Ævar Arnfjörð BjarmasonFeb 21, 2022
  3. Raphael BauerFeb 22, 2022
  4. BUG: %+ format placeholder and colorsRaphael Bauer, Mar 22, 2022
  5. Ævar Arnfjörð BjarmasonMar 23, 2022
  6. RaphaelMar 23, 2022
  7. pretty format: fix colors on %+ placeholder newlineRaphael Bauer, Apr 5, 2022
  8. Junio C HamanoApr 6, 2022
  9. RaphaelApr 8, 2022
  10. Ævar Arnfjörð BjarmasonApr 8, 2022
  11. Junio C HamanoApr 8, 2022

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.