From: Jonathan Nieder <jrnieder@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Michael J Gruber <git@drmicha.warpmail.net>,
git@vger.kernel.org,
Martin Svensson <martin.k.svensson@netinsight.se>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] commit -s: allow "(cherry picked " lines in sign-off section
Date: Tue, 16 Nov 2010 14:40:27 -0600 [thread overview]
Message-ID: <20101116204027.GB27390@burratino> (raw)
In-Reply-To: <20101116202556.GA27390@burratino>
Jonathan Nieder wrote:
> (cherry picked from commit 9d8117e72bf453dd9d85e0cd322ce4a0f8bccbc0)
>
> Signed-off-by: Back Porter <backporter@example.com>
>
> The cherry-pick is a step in the line of a patch like any other,
> so one might prefer to lose the extra newline.
Sigh. s/line/life/
[...]
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Let's kick off the reviews.
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -528,6 +528,8 @@ static int ends_rfc2822_footer(struct strbuf *sb)
> i++;
>
> for (; i < len; i = k) {
> + static const char cherry_pick[] = "(cherry picked from commit ";
> +
Better to share this string with builtin/revert.c, no?
What would happen when "(cherry picked ..." gets translated?
Should only the current language's version be tolerated in
the commit footer, or is there something more generic to
match for that could take care of wording changes automatically?
> @@ -535,6 +537,20 @@ static int ends_rfc2822_footer(struct strbuf *sb)
> if ((buf[k] == ' ' || buf[k] == '\t') && !first)
> continue;
>
> + if (!first && buf[k] == '(' && k + strlen(cherry_pick) < len) {
> + /* Might be a cherry-pick notice. */
> + const char *p = buf + k;
> + if (!memcmp(p, cherry_pick, strlen(cherry_pick))) {
> + p = memchr(buf + k, '\n', len - k);
Maybe simpler:
p = memchr(...
if (!p)
return 0;
i = p - buf;
to reuse the termination condition in the sign-off parser.
Presumably the main loop could use memchr() instead of open-coding
it as well.
next prev parent reply other threads:[~2010-11-16 20:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-16 15:11 [PATCH] cherry-pick -x: add newline before pick note Michael J Gruber
2010-11-16 19:30 ` Jeff King
2010-11-16 20:25 ` [PATCH] commit -s: allow "(cherry picked " lines in sign-off section Jonathan Nieder
2010-11-16 20:40 ` Jonathan Nieder [this message]
2010-11-16 22:52 ` Junio C Hamano
2010-11-16 23:36 ` Jonathan Nieder
2010-11-17 16:46 ` Junio C Hamano
2010-11-17 6:23 ` Jay Soffian
2010-11-17 6:14 ` [PATCH] cherry-pick -x: add newline before pick note Jay Soffian
2011-03-08 12:54 ` Oswald Buddenhagen
2011-03-08 22:08 ` Jonathan Nieder
2011-03-08 22:18 ` Oswald Buddenhagen
2011-03-08 22:34 ` Jonathan Nieder
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=20101116204027.GB27390@burratino \
--to=jrnieder@gmail.com \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=martin.k.svensson@netinsight.se \
--cc=peff@peff.net \
/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).