On Thu, Apr 8, 2021 at 10:18 AM Patrick Steinhardt <ps@xxxxxx> wrote: > While it's already possible to stop git from reading the system config > via GIT_CONFIG_NOSYSTEM, doing the same for global config files requires > the user to unset both HOME and XDG_CONFIG_HOME. This is an awkward > interface and may even pose a problem e.g. when git hooks rely on these > variables to be present. > > Introduce a new GIT_CONFIG_NOGLOBAL envvar, which is the simple > equivalent to GIT_CONFIG_NOSYSTEM. If set to true, git will skip reading > both `~/.gitconfig` and `$XDG_CONFIG_HOME/git/config`. > > Signed-off-by: Patrick Steinhardt <ps@xxxxxx> > --- > diff --git a/Documentation/git.txt b/Documentation/git.txt > @@ -670,13 +670,21 @@ for further details. > +`GIT_CONFIG_NOGLOBAL`:: > + Whether to skip reading settings from the system-wide `~/.gitconfig` > + and `$XDG_CONFIG_HOME/git/config` files. This environment variable can > + be used along with `$GIT_CONFIG_NOSYSTEM` to create a predictable > + environment for a picky script, or you can set it temporarily to avoid > + using a buggy global config file while waiting for someone with > + sufficient permissions to fix it. Not necessarily a new problem since you mostly copied the new text from GIT_CONFIG_NOSYSTEM, but this doesn't tell the reader what value to assign to this variable. As currently written, I would end up having to consult the source code to figure out how to use this variable, which makes the documentation less useful than it should be. Perhaps it could be rewritten something like: If set to any value, suppress reading global configuration from `~/.gitconfig` and `$XDG_CONFIG_HOME/git/config` files. This environment variable... The bit about waiting for someone to fix a buggy ~/.gitconfig is somewhat questionable; it might make sense to drop everything after "picky script". > `GIT_CONFIG_NOSYSTEM`:: > Whether to skip reading settings from the system-wide > `$(prefix)/etc/gitconfig` file. This environment variable can > - be used along with `$HOME` and `$XDG_CONFIG_HOME` to create a > - predictable environment for a picky script, or you can set it > - temporarily to avoid using a buggy `/etc/gitconfig` file while > - waiting for someone with sufficient permissions to fix it. > + be used along with `$GIT_CONFIG_NOGLOBAL` to create a predictable > + environment for a picky script, or you can set it temporarily to avoid > + using a buggy `/etc/gitconfig` file while waiting for someone with > + sufficient permissions to fix it. This suffers the same problem of not telling the reader what value to assign. A similar rewrite could improve it, as well.