@matheusbsbs / matheus-bagliano / commits / 8f323c00dd
Fork 0

config: drop support for GIT_CONFIG_NOGLOBAL

Now that test-lib sets $HOME to protect against pollution from user settings, GIT_CONFIG_NOGLOBAL is not needed for use by the test suite any more. And as luck would have it, a quick code search reveals no other users in the wild. This patch does not affect GIT_CONFIG_NOSYSTEM, which is still needed. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Nieder committed Mar 15, 2011 at 04:04 UTC 8f323c00dd3c9b396b01a1aeea74f7dfd061bb7f
7 files changed +4 -16
builtin/config.c
+1 -1
@@ -160,7 +160,7 @@ static int get_value(const char *key_, const char *regex_)
160 if (!local) {
161 const char *home = getenv("HOME");
162 local = repo_config = git_pathdup("config");
163 - if (git_config_global() && home)
163 + if (home)
164 global = xstrdup(mkpath("%s/.gitconfig", home));
165 if (git_config_system())
166 system_wide = git_etc_gitconfig();
cache.h
-1
@@ -1020,7 +1020,6 @@ extern const char *git_etc_gitconfig(void);
1020 extern int check_repository_format_version(const char *var, const char *value, void *cb);
1021 extern int git_env_bool(const char *, int);
1022 extern int git_config_system(void);
1023 -extern int git_config_global(void);
1023 extern int config_error_nonbool(const char *);
1024 extern const char *get_log_output_encoding(void);
1025 extern const char *get_commit_output_encoding(void);
config.c
+1 -6
@@ -826,11 +826,6 @@ int git_config_system(void)
826 return !git_env_bool("GIT_CONFIG_NOSYSTEM", 0);
827 }
828
829 -int git_config_global(void)
830 -{
831 - return !git_env_bool("GIT_CONFIG_NOGLOBAL", 0);
832 -}
833 -
829 int git_config_from_parameters(config_fn_t fn, void *data)
830 {
831 static int loaded_environment;
@@ -862,7 +857,7 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)
857 }
858
859 home = getenv("HOME");
865 - if (git_config_global() && home) {
860 + if (home) {
861 char *user_config = xstrdup(mkpath("%s/.gitconfig", home));
862 if (!access(user_config, R_OK)) {
863 ret += git_config_from_file(fn, user_config, data);
t/t0001-init.sh
+1 -4
@@ -47,7 +47,7 @@ test_expect_success 'plain nested in bare' '
47
48 test_expect_success 'plain through aliased command, outside any git repo' '
49 (
50 - sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG_NOGLOBAL &&
50 + sane_unset GIT_DIR GIT_WORK_TREE &&
51 HOME=$(pwd)/alias-config &&
52 export HOME &&
53 mkdir alias-config &&
@@ -231,7 +231,6 @@ test_expect_success 'init with init.templatedir set' '
231 git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" &&
232 mkdir templatedir-set &&
233 cd templatedir-set &&
234 - sane_unset GIT_CONFIG_NOGLOBAL &&
234 sane_unset GIT_TEMPLATE_DIR &&
235 NO_SET_GIT_TEMPLATE_DIR=t &&
236 export NO_SET_GIT_TEMPLATE_DIR &&
@@ -243,7 +242,6 @@ test_expect_success 'init with init.templatedir set' '
242 test_expect_success 'init --bare/--shared overrides system/global config' '
243 (
244 test_config="$HOME"/.gitconfig &&
246 - sane_unset GIT_CONFIG_NOGLOBAL &&
245 git config -f "$test_config" core.bare false &&
246 git config -f "$test_config" core.sharedRepository 0640 &&
247 mkdir init-bare-shared-override &&
@@ -258,7 +256,6 @@ test_expect_success 'init --bare/--shared overrides system/global config' '
256 test_expect_success 'init honors global core.sharedRepository' '
257 (
258 test_config="$HOME"/.gitconfig &&
261 - sane_unset GIT_CONFIG_NOGLOBAL &&
259 git config -f "$test_config" core.sharedRepository 0666 &&
260 mkdir shared-honor-global &&
261 cd shared-honor-global &&
t/t5601-clone.sh
-1
@@ -164,7 +164,6 @@ test_expect_success 'clone a void' '
164 test_expect_success 'clone respects global branch.autosetuprebase' '
165 (
166 test_config="$HOME/.gitconfig" &&
167 - unset GIT_CONFIG_NOGLOBAL &&
167 git config -f "$test_config" branch.autosetuprebase remote &&
168 rm -fr dst &&
169 git clone src dst &&
t/t9130-git-svn-authors-file.sh
-1
@@ -96,7 +96,6 @@ test_expect_success 'fresh clone with svn.authors-file in config' '
96 rm -r "$GIT_DIR" &&
97 test x = x"$(git config svn.authorsfile)" &&
98 test_config="$HOME"/.gitconfig &&
99 - unset GIT_CONFIG_NOGLOBAL &&
99 unset GIT_DIR &&
100 unset GIT_CONFIG &&
101 git config --global \
t/test-lib.sh
+1 -2
@@ -947,9 +947,8 @@ fi
947 GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
948 unset GIT_CONFIG
949 GIT_CONFIG_NOSYSTEM=1
950 -GIT_CONFIG_NOGLOBAL=1
950 GIT_ATTR_NOSYSTEM=1
952 -export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL GIT_ATTR_NOSYSTEM
951 +export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM
952
953 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
954