From: Jeff King Date: Mon, 12 Aug 2013 15:45:21 GMT Subject: Re: git should not use a default user.email config value Message-ID: <20130812154520.GA18215@sigill.intra.peff.net> In-Reply-To: On Mon, Aug 12, 2013 at 11:01:03PM +1000, Andrew Ardill wrote: > On 12 August 2013 22:39, Jeff King wrote: > > We could do something like the patch below, which allows: > > > > $ git config --global include./magic/.path .gitconfig-magic > > > > to read ~/.gitconfig-magic only when we are in a repository with a > > directory component "/magic/". > > Thanks, this looks great! I'll have a play with it tomorrow. > > Would locally configured config options override this one? From a > quick read of the patch there doesn't look like there is a way of > turning this off for a specific repository, but perhaps that is > unnecessary. I think after a bit of use the edge cases will be a bit > clearer. Yes, the usual config and include rules apply; the patch just selectively ignores the include based on the subsection regex. So if you put the magic include in your ~/.gitconfig, anything in the repo's .git/config will override it. But that also means the usual restrictions apply, too. There is no way to "unset" a variable as if it had never been specified in the first place. And multi-valued variables will always append (e.g., remote.*.fetch). The matcher is a regex, so depending on how tortured you want your regex to get, you can probably exclude a particular directory with that. :) -Peff