Subject: Re: [PATCH/GSoC] add a add.patch config variable

From: Dominik Fischer <[email-masked]>
Date: Fri, 25 Mar 2016 01:43:47 +0100

Am 24.03.2016 um 22:20 schrieb Junio C Hamano:
> XZS <[email-masked]> writes:
>> Users may like to review their changes when staging by default. It is
>> also a convenient safety feature for beginners nudging them to have a
>> second look at their changes when composing a commit.
>>
>> To this end, the config variable allows to have git-add to always act
>> like -p was passed.
>
> Now with such a configuration in her ~/.gitconfig, how would she
> ever run the normal "git add", which perhaps is invoked by one of
> the scripts she regularly uses?  E.g. "git mergetool"?

As the configuration variable can be overwritten by a command line 
option, I am tempted to amend this by replacing all occurrences of "git 
add" in other scripts with "git add --no-patch" to ensure the expected 
behavior.

But this would introduce changes into a vast number of points in the 
code. Apart from that, I suspect other options may have the same reason 
not to be available as config variables. It would be much better if 
git-add could ignore the variable when called internally, only taking it 
into account when used as an entrypoint.

Is there already a mechanism in place to determine if git was called by 
git? If not, I could implement one through an environment variable that 
counts up on each git invocation, essentially providing a git recursion 
counter.