Re: [PATCH v3] cherry-pick: don't forget -s on failure

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

 



Miklos Vajna <vmiklos@xxxxxxx> writes:

> +void append_signoff(struct strbuf *msgbuf, int ignore_footer)
> +{
> +	struct strbuf sob = STRBUF_INIT;
> +	int i;
> +
> +	strbuf_addstr(&sob, sign_off_header);
> +	strbuf_addstr(&sob, fmt_name(getenv("GIT_COMMITTER_NAME"),
> +				getenv("GIT_COMMITTER_EMAIL")));
> +	strbuf_addch(&sob, '\n');
> +	for (i = msgbuf->len - 1 - ignore_footer; i > 0 && msgbuf->buf[i - 1] != '\n'; i--)
> +		; /* do nothing */
> +	struct strbuf footer = STRBUF_INIT;
> +	if (ignore_footer > 0) {
> +		strbuf_addstr(&footer, msgbuf->buf + msgbuf->len - ignore_footer);
> +		strbuf_setlen(msgbuf, msgbuf->len - ignore_footer);
> +	}

That's decl-after-stmt.

I would have expected that you can just do strbuf_splice() to add
the &sob into &msgbuf with the original code structure, without a
substantial rewrite of the function like this.  Perhaps I am missing
something?
--
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]