public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Harry Jeffery <harry@exec64•co.uk>, git@vger•kernel.org
Subject: Re: [PATCH] pretty-format: add append line-feed format specifier
Date: Wed, 10 Sep 2014 10:19:21 -0700	[thread overview]
Message-ID: <xmqqtx4fgzqe.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20140909214520.GA13603@peff.net> (Jeff King's message of "Tue, 9 Sep 2014 17:45:21 -0400")

Jeff King <peff@peff•net> writes:

> 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.

  parent reply	other threads:[~2014-09-10 17:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09 18:09 [PATCH] pretty-format: add append line-feed format specifier Harry Jeffery
2014-09-09 19:15 ` Junio C Hamano
2014-09-09 19:30   ` Harry Jeffery
2014-09-09 19:37     ` Junio C Hamano
2014-09-09 21:45       ` Jeff King
2014-09-09 22:17         ` Harry Jeffery
2014-09-09 22:31           ` Jeff King
2014-09-10 17:19         ` Junio C Hamano [this message]
2014-09-12  4:49           ` Jeff King
2014-09-12 16:36             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqtx4fgzqe.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=harry@exec64$(echo .)co.uk \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox