Re: [PATCH] pretty-format: add append line-feed format specifier
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 10, 2014, 17:19 UTC
- Message-ID
- <xmqqtx4fgzqe.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <20140909214520.GA13603@peff.net>
Jeff King <peff@peff.net> writes:
Show 16 quoted lines
> 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. > > With it, you can do: > > git log --format='%h %s%if(%d,%n Decoration:%d)' origin > ... > 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.
Yup.
I do not think we need to go overboard to support nesting and stuff, let alone turing completeness ;-), especially when we are going to test the condition part only for emptyness. Even with this simple patch, I sense that we are near a slipperly slope of wanting to add %unless(%d, ) or %ifelse(%d,%d, \(undefined\)), so I am not 100% convinced yet.