Subject: Re: [PATCH] rebase: use strvec_pushf() for format-patch revisions

From: Junio C Hamano <[email-masked]>
Date: Wed, 20 Dec 2023 07:57:13 -0800

René Scharfe <[email-masked]> writes:

> Am 19.12.23 um 18:12 schrieb Junio C Hamano:
>> René Scharfe <[email-masked]> writes:
>>
>>> In run_am(), a strbuf is used to create a revision argument that is then
>>> added to the argument list for git format-patch using strvec_push().
>>> Use strvec_pushf() to add it directly instead, simplifying the code.
>>>
>>> Signed-off-by: René Scharfe <[email-masked]>
>>> ---
>>
>> Makes sense.  Between the location of the original strbuf_addf()
>> call and the new strvec_pushf() call, nobody mucks with *opts so
>> this change won't affect the correctness.  We no longer use the
>> extra strbuf, and upon failing to open the rebased-patches file,
>> we no longer leak the contents of it.  Good.
>
> Ha!  I didn't even notice that leak on error.  Perhaps the two release
> calls at the end gave me the illusion of cleanliness?  Or more likely
> the opportunity to use strvec_pushf() grabbed my full attention (tunnel
> vision).

Perhaps I'll amend the end of the log message, like so, before
merging it down to 'next', then.

    ..., simplifying the code and plugging a small leak on the error
    codepath.

Thanks.