allow suppressing of global and system config

The GIT_CONFIG_NOGLOBAL and GIT_CONFIG_NOSYSTEM environment
variables are magic undocumented switches that can be used
to ensure a totally clean environment. This is necessary for
running reliable tests, since those config files may contain
settings that change the outcome of tests.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2008-02-06 05:11:18 -05:00
committed by Junio C Hamano
parent b828fef678
commit ab88c36321
3 changed files with 24 additions and 4 deletions

View File

@ -79,9 +79,10 @@ static int get_value(const char* key_, const char* regex_)
local = getenv(CONFIG_LOCAL_ENVIRONMENT);
if (!local)
local = repo_config = xstrdup(git_path("config"));
if (home)
if (git_config_global() && home)
global = xstrdup(mkpath("%s/.gitconfig", home));
system_wide = git_etc_gitconfig();
if (git_config_system())
system_wide = git_etc_gitconfig();
}
key = xstrdup(key_);