summaryrefslogtreecommitdiff
path: root/builtin-config.c
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2008-06-30 03:37:47 -0400
committerJunio C Hamano <gitster@pobox.com>2008-07-01 02:35:49 -0700
commitdc87183189b54441e315d35d48983d80ab085299 (patch)
tree975e86756cc3739cdfb7ac3f93981b37a2a8f8ad /builtin-config.c
parent66037991d3fd2ac7e699c7bd21d939b9e397f6a4 (diff)
downloadgit-dc87183189b54441e315d35d48983d80ab085299.tar.gz
Only use GIT_CONFIG in "git config", not other programs
For everything other than using "git config" to read or write a git-style config file that isn't the current repo's config file, GIT_CONFIG was actively detrimental. Rather than argue over which programs are important enough to have work anyway, just fix all of them at the root. Also removes GIT_LOCAL_CONFIG, which would only be useful for programs that do want to use global git-specific config, but not the repo's own git-specific config, and want to use some other, presumably git-specific config. Despite being documented, I can't find any sign that it was ever used. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-config.c')
-rw-r--r--builtin-config.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/builtin-config.c b/builtin-config.c
index 3a441ef648..39f63d7b10 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -81,12 +81,10 @@ static int get_value(const char* key_, const char* regex_)
char *global = NULL, *repo_config = NULL;
const char *system_wide = NULL, *local;
- local = getenv(CONFIG_ENVIRONMENT);
+ local = config_exclusive_filename;
if (!local) {
const char *home = getenv("HOME");
- local = getenv(CONFIG_LOCAL_ENVIRONMENT);
- if (!local)
- local = repo_config = xstrdup(git_path("config"));
+ local = repo_config = xstrdup(git_path("config"));
if (git_config_global() && home)
global = xstrdup(mkpath("%s/.gitconfig", home));
if (git_config_system())
@@ -289,6 +287,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
char* value;
const char *file = setup_git_directory_gently(&nongit);
+ config_exclusive_filename = getenv(CONFIG_ENVIRONMENT);
+
while (1 < argc) {
if (!strcmp(argv[1], "--int"))
type = T_INT;
@@ -309,14 +309,13 @@ int cmd_config(int argc, const char **argv, const char *prefix)
char *home = getenv("HOME");
if (home) {
char *user_config = xstrdup(mkpath("%s/.gitconfig", home));
- setenv(CONFIG_ENVIRONMENT, user_config, 1);
- free(user_config);
+ config_exclusive_filename = user_config;
} else {
die("$HOME not set");
}
}
else if (!strcmp(argv[1], "--system"))
- setenv(CONFIG_ENVIRONMENT, git_etc_gitconfig(), 1);
+ config_exclusive_filename = git_etc_gitconfig();
else if (!strcmp(argv[1], "--file") || !strcmp(argv[1], "-f")) {
if (argc < 3)
usage(git_config_set_usage);
@@ -325,7 +324,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
argv[2]);
else
file = argv[2];
- setenv(CONFIG_ENVIRONMENT, file, 1);
+ config_exclusive_filename = file;
argc--;
argv++;
}