Re: [PATCH] builtin-commit: fix --signoff
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Nov 10, 2007, 13:47 UTC
- Message-ID
- <Pine.LNX.4.64.0711101346120.4362@racer.site>
- In-Reply-To
- <7vr6iyo4ff.fsf@gitster.siamese.dyndns.org>
Hi,
On Sat, 10 Nov 2007, Junio C Hamano wrote:
Show 19 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > if (signoff) {
> > ...
> > + strbuf_init(&sob, 0);
> > + strbuf_addstr(&sob, sign_off_header);
> > + strbuf_addstr(&sob, git_committer_info(1));
> > + p = strrchr(sob.buf, '>');
> > + if (p)
> > + strbuf_setlen(&sob, p + 1 - sob.buf);
> > + strbuf_addch(&sob, '\n');
> > +
> > + for (i = sb.len - 1; i > 0 && sb.buf[i - 1] != '\n'; i--)
> > + ; /* do nothing */
> > + if (prefixcmp(sb.buf + i, sob.buf))
> > + strbuf_addbuf(&sb, &sob);
> > }
>
> At this point doesn't this leak sob.buf?Darn. I had a "strbuf_release(&sob);" there, but at some stage removed it by mistake.
But there is more to be fixed. Rather than let git_committer_info() add the timestamp, only to strip it away, is a waste.
Will redo the patch.
Ciao, Dscho