From: Jeff King <peff@peff.net>
To: Eric Wong <e@yhbt.net>
Cc: Timothee Cour <timothee.cour2@gmail.com>, git@vger.kernel.org
Subject: Re: git makes it impossible to ignore or override global gitconfig, needs `GITCONFIGFILE`
Date: Thu, 19 Mar 2020 12:51:49 -0400 [thread overview]
Message-ID: <20200319165149.GA4074934@coredump.intra.peff.net> (raw)
In-Reply-To: <20200319064407.GA26408@dcvr>
On Thu, Mar 19, 2020 at 06:44:07AM +0000, Eric Wong wrote:
> Timothee Cour <thelastmammoth@gmail.com> 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
next prev parent reply other threads:[~2020-03-19 16:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-19 5:48 git makes it impossible to ignore or override global gitconfig, needs `GITCONFIGFILE` Timothee Cour
2020-03-19 6:44 ` Eric Wong
2020-03-19 16:51 ` Jeff King [this message]
2020-03-20 2:28 ` Timothee Cour
2020-03-20 5:41 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200319165149.GA4074934@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=e@yhbt.net \
--cc=git@vger.kernel.org \
--cc=timothee.cour2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).