summaryrefslogtreecommitdiff
path: root/builtin-config.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-02-06 05:11:18 -0500
committerJunio C Hamano <gitster@pobox.com>2008-02-06 14:52:23 -0800
commitab88c36321df647e17d477f19591cf6ca95de7f0 (patch)
tree8523c9bde61394afe1c658df8d5d54f642ac793e /builtin-config.c
parentb828fef678c21d017f18d2094bfdaac94e5fbf7a (diff)
downloadgit-ab88c36321df647e17d477f19591cf6ca95de7f0.tar.gz
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>
Diffstat (limited to 'builtin-config.c')
-rw-r--r--builtin-config.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin-config.c b/builtin-config.c
index e4a12e3166..404bb449ae 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -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_);