From: Jeff King Date: Fri, 02 Sep 2011 17:53:23 GMT Subject: Re: [PATCH] for-each-ref: add split message parts to %(contents:*). Message-ID: <20110902175323.GA29761@sigill.intra.peff.net> In-Reply-To: <20110902193931.42593338@pomiocik.lan> On Fri, Sep 02, 2011 at 07:39:26PM +0200, Michał Górny wrote: > > > + /* 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: > [...] > > Any suggestion how to strip trailing newlines? Just looking at your patch, it might work to do: else if (*buf == '\n') *body = buf - 1; else *body = buf; But there may be other corner cases. I need to read through the code more carefully, which I should have time to do later today. -Peff