Re: [PATCH] for-each-ref: add split message parts to %(contents:*).
- From
Jeff King <peff@peff.net>
- Date
- Sep 2, 2011, 16:39 UTC
- Message-ID
- <20110902163903.GA21768@sigill.intra.peff.net>
- In-Reply-To
- <1314895801-21147-1-git-send-email-mgorny@gentoo.org>
On Thu, Sep 01, 2011 at 06:50:01PM +0200, Michał Górny wrote:
Show 16 quoted lines
> - 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 subject -Peff