Subject: Re: [PATCH 5/7] enforce `xfuncname` precedence over `funcname`

From: Matthieu Moy <[email-masked]>
Date: Fri, 25 Jul 2014 19:45:16 +0200

Junio C Hamano <[email-masked]> writes:

> Matthieu Moy <[email-masked]> writes:
>
>> Tanay Abhra <[email-masked]> writes:
>>
>>> On 7/25/2014 2:52 AM, Ramsay Jones wrote:
>>>> However, I think it you could create a list of <pointer to hash-table
>>>> entry, string-list index> pairs in the config_set and use that to do
>>>> the iteration. A bit ugly, but it should work.
>>>
>>> Thanks for the advice, that is exactly what I am doing.
>>
>> I'd just replace "list" with "array" and use
>> Documentation/technical/api-allocation-growing.txt.
>>
>> But I can't think of a better way.
>
> Presumably this array will reflect the order the source file told us
> about the keys and their values; I wonder if the <filename, lineno>
> information we already have can be used (or unified) with it?

I've thought about this too, and I think it would be really hard.

First, there are several files in the picture (eg. /etc/gitconfig,
~/.gitconfig and .git/config), and even included files hence it's not
even a lexical order (file, line).

Then, even if we had a way to order elements with (file, line),
iterating over the hashtable in this order wouldn't be easy (the naive
way, "get the smallest, get the second smallest, ..." would be O(n^2)).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/