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

Re: [PATCH v2 3/3] for-each-ref: introduce %(color:...) for color

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Nov 18, 2013, 16:45 UTC
Message-ID
<CALkWK0ngKTkFbaq7NzCW7T3KyfmWxpDEv8TLj05LoThob1fpFg@mail.gmail.com>
In-Reply-To
<xmqq4n79d6f1.fsf@gitster.dls.corp.google.com>
Junio C Hamano wrote:
Show 9 quoted lines
> If you are saying, by after each token, that
>
>         --format='%(color:blue)%(A)literal string%(B)'
>
> should result in
>
>         <color blue> <value for A> <color reset> "literal string" <value for B>
>
> then I would disagree.

Hm, I didn't think it was a bad idea to reset after each token. The whole point of having color is to make sure that two consecutive tokens don't have the same color, no? Then again, my scheme would result in extra unnecessary resets like

  %(color:blue)%(A)%(color:green)%(B)
being turned into:
  %(color:blue)%(A)%(color:reset)%(color:green)%(B)%(color:reset)
Here, the first %(color:reset) is completely unnecessary.
Show 9 quoted lines
> I was suggesting it to instead produce
>
>         <color blue> <value for A> "literal string" <value for B> <color reset>
>
> where the <color reset> always comes when some color is used and we
> hit the end of the format string. A bonus point if we can make it so
> that we emit the final reset only when the last "%(color:some)" is
> not "%(color:reset)", but unconditional "reset if we ever used
> color" is fine.
Okay, a simple don't-leak-color. I'll submit another iteration soon.
Thanks.
Previous: Junio C Hamano
Message 12 of 12 in “Minor f-e-r enhacements”
  1. 0/3 Minor f-e-r enhacementsRamkumar Ramachandra, Nov 13, 2013
  2. 1/3 for-each-ref: introduce %(HEAD) asterisk markerRamkumar Ramachandra, Nov 13, 2013
  3. 2/3 for-each-ref: introduce %(upstream:track[short])Ramkumar Ramachandra, Nov 13, 2013
  4. Junio C HamanoNov 13, 2013
  5. Junio C HamanoNov 13, 2013
  6. Ramkumar RamachandraNov 14, 2013
  7. 3/3 for-each-ref: introduce %(color:...) for colorRamkumar Ramachandra, Nov 13, 2013
  8. Junio C HamanoNov 13, 2013
  9. Junio C HamanoNov 13, 2013
  10. Ramkumar RamachandraNov 14, 2013
  11. Junio C HamanoNov 18, 2013
  12. Ramkumar RamachandraNov 18, 2013

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.