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

Re: [RFC PATCH] show decorations at the end of the line

From
Jeff King <peff@peff.net>
Date
Feb 21, 2017, 22:24 UTC
Message-ID
<20170221222451.kiuyrp3raufhvkte@sigill.intra.peff.net>
In-Reply-To
<xmqq8tozfc7a.fsf@gitster.mtv.corp.google.com>
On Tue, Feb 21, 2017 at 01:47:37PM -0800, Junio C Hamano wrote:
Show 16 quoted lines
> > So the best I could come up with is:
> >
> >   git config pretty.twoline '%C(auto)%h %s%C(auto)%+d'
> >   git log --format=twoline
> > [...]
>
> Yeah, I had a similar thought to use something around "%n%-d", but
> 
>  $ git log --format='%h%n%-d%C(auto) %s %C(auto)'
> 
> is not it.
> 
> I guess we could pile on another hack to make the sign between % and
> the format specifier cumulative and then "%n%-+d" may do what we
> want, but we need a true %(if)...%(then)...%(else)...%(end) support
> if we really want to do this thing properly.

Yeah, I'd rather not pile up more hacks. The for-each-ref placeholders are more verbose, but I think the end result is a lot easier to read and maintain, and the terseness doesn't matter if you're sticking it behind an alias or config option.

(Don't get me wrong; I think the %(if) ones are pretty ugly, too, but the next step beyond that is embedding some kind of templating or scripting language, and that just seems like overkill).

-Peff
Previous: Junio C HamanoNext: Stephan Beyer
Message 19 of 20 in “show decorations at the end of the line”
  1. show decorations at the end of the lineLinus Torvalds, Feb 11, 2017
  2. Linus TorvaldsFeb 11, 2017
  3. Junio C HamanoFeb 13, 2017
  4. Linus TorvaldsFeb 13, 2017
  5. Junio C HamanoFeb 13, 2017
  6. Jeff KingFeb 13, 2017
  7. Junio C HamanoFeb 14, 2017
  8. Jeff KingFeb 15, 2017
  9. Junio C HamanoFeb 18, 2017
  10. Linus TorvaldsFeb 19, 2017
  11. Jacob KellerFeb 19, 2017
  12. Jeff KingFeb 20, 2017
  13. Junio C HamanoFeb 20, 2017
  14. Linus TorvaldsFeb 20, 2017
  15. Junio C HamanoFeb 21, 2017
  16. Linus TorvaldsFeb 21, 2017
  17. Jeff KingFeb 21, 2017
  18. Junio C HamanoFeb 21, 2017
  19. Jeff KingFeb 21, 2017
  20. Stephan BeyerFeb 14, 2017

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.