Re: [PATCH] for-each-ref: add split message parts to %(contents:*).
- From
Michał Górny <mgorny@gentoo.org>
- Date
- Sep 2, 2011, 17:39 UTC
- Message-ID
- <20110902193931.42593338@pomiocik.lan>
- In-Reply-To
- <20110902163903.GA21768@sigill.intra.peff.net>
On Fri, 2 Sep 2011 12:39:03 -0400 Jeff King <peff@peff.net> wrote:
Show 32 quoted lines
> On Thu, Sep 01, 2011 at 06:50:01PM +0200, Michał Górny wrote:
>
> > - buf = strchr(buf, '\n');
> > - if (!buf) {
> > - *body = "";
> > - return; /* no body */
> > - }
> > - while (*buf == '\n')
> > - buf++; /* skip blank between subject and body */
> > - *body = buf;
> > + buf = format_subject(NULL, buf, NULL);
> > +
> > + /* When having a signed tag without body, format_subject()
> > + * will start to eat the signature. */
> > + if (buf > *signature)
> > + *body = *signature;
> > + else /* - 1 to get a trailing newline to strip */
> > + *body = buf - 1;
>
> This last line is wrong if there is no trailing newline, no? Running
> even the existing tests in t6300 against your new patch, I get:
>
> expecting success:
> git for-each-ref --format='%(subject)' refs/heads/master >actual &&
> test_cmp expected actual
>
> --- expected 2011-09-02 16:36:38.306058729 +0000
> +++ actual 2011-09-02 16:36:38.318058729 +0000
> @@ -1 +1 @@
> -Initial
> +Initia
> not ok - 28 basic atom: head subjectAny suggestion how to strip trailing newlines?
-- Best regards, Michał Górny