Re: [PATCH v7 4/4] notes: teach git-notes about notes.<ref>.mergestrategy option

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

 



On Fri, Aug 14, 2015 at 3:10 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> On Fri, Aug 14, 2015 at 6:01 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> Jacob Keller <jacob.e.keller@xxxxxxxxx> writes:
>>> diff --git a/builtin/notes.c b/builtin/notes.c
>>> index 12a42b583f98..bdfd9c7d29b4 100644
>>> --- a/builtin/notes.c
>>> +++ b/builtin/notes.c
>>> +             strbuf_addf(&merge_key, "notes.%s.mergestrategy", short_ref);
>>> +
>>> +             if (git_config_get_notes_strategy(merge_key.buf, &o.strategy))
>>> +                     git_config_get_notes_strategy("notes.mergestrategy", &o.strategy);
>>>       }
>>
>> I think you are leaking merge_key after you are done using it.
>
> In addition to fixing the leak, since 'merge_key' is only used within
> this block, it might also make sense to declare it in this block
> rather than at the top of the function.

I can do that.

How do you feel about having the duplicate check for the short_ref? We
*already* check this inside init_notes_check() which is called right
after this.

I think that we should keep it but can't find a consistent way to
avoid the duplication.

In addition, we already provide the tests for merging into and from
non-notes refs.

Regards,
Jake
--
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]