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

Re: [PATCH] pretty-format: add append line-feed format specifier

From
Harry Jeffery <harry@exec64.co.uk>
Date
Sep 9, 2014, 22:17 UTC
Message-ID
<540F7C70.4010909@exec64.co.uk>
In-Reply-To
<20140909214520.GA13603@peff.net>
On 09/09/14 22:45, Jeff King wrote:
Show 8 quoted lines
> Yeah, that was my thought on reading the initial patch, too. Why limit
> ourselves to newlines and spaces. I'd much rather have full conditional
> expansion, like "${foo:+prefix $foo suffix}" in the shell.
>
> Something like the patch below might work, but I didn't test it very
> thoroughly (and note the comments, which might need dealing with). Maybe
> it would make a sensible base for Harry to build on if he wants to
> pursue this.

I definitely prefer your more general solution to my bare-minimum-to-scratch-itch patch. I'd certainly be willing to take your patch and expand upon it (pun unintended) once Junio has weighed in on your suggestions.

Show 7 quoted lines
> You could also make "%d" more flexible with it. We unconditionally
> include the " (...)" wrapper when expanding it. But assuming we
> introduced a "%D" that is _just_ the decoration names, you could do:
>
>    %if(%D, (%D))
>
> to get the same effect with much more flexibility.

Regardless of what happens with the conditional expansion I think it would definitely be a useful addition to be able to print the decorators without the " (...)" wrapper. I think it's general enough that it'd warrant its own separate patch rather than being part of a patch series for the conditional expansion.

Previous: Jeff KingNext: Jeff King
Message 6 of 10 in “pretty-format: add append line-feed format specifier”
  1. pretty-format: add append line-feed format specifierHarry Jeffery, Sep 9, 2014
  2. Junio C HamanoSep 9, 2014
  3. Harry JefferySep 9, 2014
  4. Junio C HamanoSep 9, 2014
  5. Jeff KingSep 9, 2014
  6. Harry JefferySep 9, 2014
  7. Jeff KingSep 9, 2014
  8. Junio C HamanoSep 10, 2014
  9. Jeff KingSep 12, 2014
  10. Junio C HamanoSep 12, 2014

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.