# [PATCH v2] Replace tmpname with pack_tmp_name in warning. The developer mistook tmpname for pack_tmp_name.

3 messages from 2014-03-02 to 2014-03-02. Participants: Sun He, Eric Sunshine, He Sun.
Thread: https://gitlist.dev/t/36017

## Sun He, 2014-03-02 02:43

Subject: [PATCH v2] Replace tmpname with pack_tmp_name in warning. The developer mistook tmpname for pack_tmp_name.
Message-ID: <1393728219-3142-1-git-send-email-sunheehnus@gmail.com>
URL: https://gitlist.dev/e/1393728219-3142-1-git-send-email-sunheehnus%40gmail.com

```
Signed-off-by: Sun He <sunheehnus@gmail.com>
---

 As tmpname is used without initialization, it should be a mistake.

 builtin/pack-objects.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index c733379..4922ce5 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -823,7 +823,7 @@ 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));
 			}
 
 			/* Enough space for "-<sha-1>.pack"? */
-- 
1.9.0.138.g2de3478.dirty

```

## Eric Sunshine, 2014-03-02 03:59

Subject: Re: [PATCH v2] Replace tmpname with pack_tmp_name in warning. The developer mistook tmpname for pack_tmp_name.
Message-ID: <CAPig+cQS53vzZQrkeZDX7ci4708o9bVp5QMvNnesZU17u1Fz2w@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcQS53vzZQrkeZDX7ci4708o9bVp5QMvNnesZU17u1Fz2w%40mail.gmail.com
In-Reply-To: <1393728219-3142-1-git-send-email-sunheehnus@gmail.com>

```
On Sat, Mar 1, 2014 at 9:43 PM, Sun He <sunheehnus@gmail.com> wrote:
> Subject: Replace tmpname with pack_tmp_name in warning. The developer mistook tmpname for pack_tmp_name.

The subject should be a short summary of the change, and the rest of
the commit message before the "---" line provides extra detail
explaining the change.

> Signed-off-by: Sun He <sunheehnus@gmail.com>
> ---
>
>  As tmpname is used without initialization, it should be a mistake.

This is valid information for the commit message above the "---" line.
So, your full commit message might say something like this:

    Subject: write_pack_file: use correct variable in diagnostic

    'pack_tmp_name' is the subject of the utime() check, so report
    it in the warning, not the uninitialized 'tmpname'.

>  builtin/pack-objects.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index c733379..4922ce5 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -823,7 +823,7 @@ 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));
>                         }
>
>                         /* Enough space for "-<sha-1>.pack"? */
> --
> 1.9.0.138.g2de3478.dirty

```

## He Sun, 2014-03-02 07:18

Subject: Re: [PATCH v2] Replace tmpname with pack_tmp_name in warning. The developer mistook tmpname for pack_tmp_name.
Message-ID: <CAJr59C0vf7F9eXgJVmFfC4gbHDHFvx14Z1ywz8YeLMSWLgVRkA@mail.gmail.com>
URL: https://gitlist.dev/e/CAJr59C0vf7F9eXgJVmFfC4gbHDHFvx14Z1ywz8YeLMSWLgVRkA%40mail.gmail.com
In-Reply-To: <CAPig+cQS53vzZQrkeZDX7ci4708o9bVp5QMvNnesZU17u1Fz2w@mail.gmail.com>

```
2014-03-02 11:59 GMT+08:00 Eric Sunshine <sunshine@sunshineco.com>:
> On Sat, Mar 1, 2014 at 9:43 PM, Sun He <sunheehnus@gmail.com> wrote:
>> Subject: Replace tmpname with pack_tmp_name in warning. The developer mistook tmpname for pack_tmp_name.
>
> The subject should be a short summary of the change, and the rest of
> the commit message before the "---" line provides extra detail
> explaining the change.
>

OK, got it.
Thank you very much.

>> Signed-off-by: Sun He <sunheehnus@gmail.com>
>> ---
>>
>>  As tmpname is used without initialization, it should be a mistake.
>
> This is valid information for the commit message above the "---" line.
> So, your full commit message might say something like this:
>
>     Subject: write_pack_file: use correct variable in diagnostic
>
>     'pack_tmp_name' is the subject of the utime() check, so report
>     it in the warning, not the uninitialized 'tmpname'.
>

Thank you for your suggestion, I will modify it right now. :-)

>>  builtin/pack-objects.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
>> index c733379..4922ce5 100644
>> --- a/builtin/pack-objects.c
>> +++ b/builtin/pack-objects.c
>> @@ -823,7 +823,7 @@ 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));
>>                         }
>>
>>                         /* Enough space for "-<sha-1>.pack"? */
>> --
>> 1.9.0.138.g2de3478.dirty

```
