Re: [PATCH] for-each-ref: add split message parts to %(contents:*).
- From
Jeff King <peff@peff.net>
- Date
- Aug 31, 2011, 16:42 UTC
- Message-ID
- <20110831164233.GA4356@sigill.intra.peff.net>
- In-Reply-To
- <1314781909-19252-1-git-send-email-mgorny@gentoo.org>
On Wed, Aug 31, 2011 at 11:11:49AM +0200, Michał Górny wrote:
Show 11 quoted lines
> @@ -478,18 +481,20 @@ static void find_subpos(const char *buf, unsigned long sz, const char **sub, con
> buf = strchr(buf, '\n');
> if (!buf) {
> *body = "";
> + *signature = *body;
> return; /* no body */
> }
> while (*buf == '\n')
> buf++; /* skip blank between subject and body */
> *body = buf;
> + *signature = buf + parse_signature(buf, strlen(buf));Hmm. I had doubts at first that "buf" is guaranteed to be NUL-terminated, since we are passing around the "sz" parameter (though note that we also use strchr already). But I think it is OK, as the buffer comes from read_sha1_file, which defensively NUL-terminates all objects we get.
Other than that, the patch looks fine. It could use some tests, so I'll follow up with some:
[1/2]: t7004: factor out gpg setup [2/2]: t6300: test new content:* for-each-ref placeholders
-Peff