Re: [PATCH] commit -s: allow "(cherry picked " lines in sign-off section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder wrote:

> 	(cherry picked from commit 9d8117e72bf453dd9d85e0cd322ce4a0f8bccbc0)
> 
> 	Signed-off-by: Back Porter <backporter@xxxxxxxxxxx>
> 
> 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@xxxxxxxxx>

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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]