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

From: Junio C Hamano <[email-masked]>
Date: Wed, 23 Jul 2014 15:34:19 -0700

Tanay Abhra <[email-masked]> writes:

> t4018-diff-funcname.sh fails for the new `git_config()` which uses the
> configuration files caching layer internally.
> The test introduced in commit d64d6cdc checks that whether `xfuncname` takes
> precedence over `funcname` variable which was not guaranteed by config API
> previously and worked only because values were parsed and fed in order.

The above is hard to understand.  Do you mean that the old code and
test used whichever (between funcname and xfuncname) appeared last
in the configuration file?

For example, if I had

	diff.foo.xfuncname "Beer$"

in my ~/.gitconfig and then for a particular project I wanted to use
a custom pattern in its .git/config but it was sufficient to define
the pattern without using extended regexp, I would be tempted to say

	diff.foo.funcname "Wine$"

With the "last one of xfuncname or funcname wins" rule, I do not
have to worry about having xfuncname in ~/.gitconfig when I do so,
but with "xfuncname is stronger than funcname" rule, it suddenly
forces me to go back and check if I have something stronger in my
lower-precedence configuration file (i.e. ~/.gitconfig) when I am
trying to override with a higher-precedence configuration file
(i.e. the project-specific .git/config).

If that is what this patch is trying to change, I am not sure if I
agree that is a good change.  They are two ways to spell the same
information, and I would find it more natural if a later funcname
spelled in BRE allowed me to override an earlier xfuncname spelled
in ERE.