git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Ilya Tumaykin <itumaykin@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Bug: "git log --format='format:%+s%+b'" doesn't insert newline before body
Date: Mon, 25 Jul 2016 10:06:28 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1607251003360.14111@virtualbox> (raw)
In-Reply-To: <1693749.WYZjdcdZj5@photon>

Hi Ilya,

On Mon, 25 Jul 2016, Ilya Tumaykin wrote:

> On Monday 25 July 2016 09:33:00 Johannes Schindelin wrote:
> > 
> > On Sun, 24 Jul 2016, Ilya Tumaykin wrote:
> > [...]
> > > $ git --no-pager log -1 --format='format:%+s%+b'
> > > 
> > > Actual results:
> > > ```
> > > 
> > > This is subject
> > > And this is body
> > > ```
> 
> According to 'git-log' man page '%+b' should insert linefeed "immediately 
> before the expansion if and only if the placeholder expands to a non-empty 
> string." Here "%b" expands to a non-empty string, thus I expect a linefeed 
> before it. Or am I misinterpreting man page somehow?

The line break is there: after the subject. The misinterpretation is most
likely the assumption that the new-line "character" is part of the commit
subject; It is not.

> > Unless you somehow allow empty commit messages (Git does not, unless
> > you play games with low-level commands), the second '+' is
> > unnecessarily conditional. Therefore "%s%n%+b" *might* do what you
> > intended (I would not know, because that information was missing from
> > the report).
> 
> I want to display '%B', but add colours to '%s'. Thus I have to
> separately include '%s' and '%b', and not just '%B'. I was using
> '%+s%n%+b' with extra colour formatting as a workaround for some time
> now.

Okay. Hopefully the explanation above clarifies that this is not a
work-around, but the correct solution.

Ciao,
Johannes

  reply	other threads:[~2016-07-25  8:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-24 13:46 Bug: "git log --format='format:%+s%+b'" doesn't insert newline before body Ilya Tumaykin
2016-07-25  6:55 ` Bug: Beat Bolli
2016-07-25  7:33 ` Bug: "git log --format='format:%+s%+b'" doesn't insert newline before body Johannes Schindelin
2016-07-25  7:51   ` Ilya Tumaykin
2016-07-25  8:06     ` Johannes Schindelin [this message]
2016-07-25 10:49       ` Ilya Tumaykin
2016-07-25 17:28   ` Jakub Narębski

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=alpine.DEB.2.20.1607251003360.14111@virtualbox \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=itumaykin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).