Re: git makes it impossible to ignore or override global gitconfig, needs `GITCONFIGFILE`

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

 



On Thu, Mar 19, 2020 at 06:44:07AM +0000, Eric Wong wrote:

> Timothee Cour <thelastmammoth@xxxxxxxxx> wrote:
> > git makes it impossible to ignore global gitconfig. This is
> > essentially what's being asked here:
> > https://stackoverflow.com/questions/23400449/how-to-make-git-temporarily-ignore-gitconfig
> > 
> > ## proposal:
> > add an environment variable (like for tig and other programs), eg:
> > `GITCONFIGFILE=~/.gitconfig_temp git diff`
> > seems like an easy change that would make it easy for users to ignore
> > or override their gitconfig
> 
> You can use GIT_CONFIG for that, and there's also
> GIT_CONFIG_NOSYSTEM.  They're both documented in the
> git-config(5) manpage.

I don't think $GIT_CONFIG is what Timothee whats. It only affects the
git-config command, not config lookup in other programs. And it
overrides _all_ config lookup, as if "git config --file" had been used.

There's no variable to suppress just the user-level gitconfig. The usual
technique (that we use in the test scripts) is to point $HOME somewhere
else, but that may affect other programs.

I wouldn't be opposed to GIT_CONFIG_NOGLOBAL if there's a use case, but
it sounds like the desire is to actually provide new config. That can
also be done for specific options with "git -c". Under the hood that is
using GIT_CONFIG_PARAMETERS in the environment; you can set it
individually, but note that it's a little picky about quoting (the
individual keys are shell-quoted, but it insists that there is an outer
layer of single-quotes, even if they weren't necessary; I wouldn't be
opposed to making it more friendly). You can see what it produces like
this:

  git -c alias.dump='!echo "$GIT_CONFIG_PARAMETERS"' dump

-Peff



[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]

  Powered by Linux