Code

install-doc-quick - use git --exec-path to find git-sh-setup
[git.git] / builtin-config.c
index 3a441ef64868b7c477ee9c49546ef1cb39e5acad..39f63d7b10f93a0a021d8b9af9fdec46ed0333f6 100644 (file)
@@ -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++;
                }