Re: [PATCH] Rewrite bulk-checkin.c:finish_bulk_checkin() to use a strbuf for handling packname
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Feb 28, 2014, 20:47 UTC
- Message-ID
- <CAPig+cT8ziBV3w9gTR_GM=xupmJiZ=2hvizagk+SR3GY_wMGUw@mail.gmail.com>
- In-Reply-To
- <CAJr59C1ezbeG5+x2VHCnxbfATXgVO1gq9+b3amgvKUqZa0Swkg@mail.gmail.com>
On Fri, Feb 28, 2014 at 10:54 AM, 孙赫 <sunheehnus@gmail.com> wrote:
Show 35 quoted lines
> 2014-02-28 17:47 GMT+08:00 Eric Sunshine [via git]
> <ml-node+s661346n7604473h64@n2.nabble.com>:
>> On Fri, Feb 28, 2014 at 3:28 AM, Sun He <[hidden email]> wrote:
>>> Signed-off-by: Sun He <[hidden email]>
>>> ---
>> > diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
>>
>>> index c733379..72fb82b 100644
>>> --- a/builtin/pack-objects.c
>>> +++ b/builtin/pack-objects.c
>>> @@ -803,7 +803,7 @@ static void write_pack_file(void)
>>>
>>> if (!pack_to_stdout) {
>>> struct stat st;
>>> - char tmpname[PATH_MAX];
>>> + struct strbuf tmpname = STRBUF_INIT;
>>>
>>> /*
>>> * Packs are runtime accessed in their mtime
>>> @@ -823,26 +823,22 @@ static void write_pack_file(void)
>>> utb.modtime = --last_mtime;
>>> if (utime(pack_tmp_name, &utb) < 0)
>>> warning("failed utime() on %s:
>>> %s",
>>> - tmpname, strerror(errno));
>>> + pack_tmp_name,
>>> strerror(errno));
>>
>> Good catch finding this bug (as your commentary below states).
>> Ideally, each conceptual change should be presented distinctly from
>> others, so this bug should have its own patch (even though it's just a
>> one-liner).
>>
>
> OK. Should I send this patch?Yes, it is perfectly acceptable (and encouraged) to send this patch as a submission distinct from your microproject.