config: only read .git/config from configured repos
[gitweb.git] / config.c
index 1d2331aa085891cb3fe344e030a0fec5cbe62272..5e50fb1a31a5b4e0bb3c4cf517023c447c2f925f 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1194,7 +1194,7 @@ static int do_git_config_sequence(config_fn_t fn, void *data)
        int ret = 0, found = 0;
        char *xdg_config = xdg_config_home("config");
        char *user_config = expand_user_path("~/.gitconfig");
-       char *repo_config = git_pathdup("config");
+       char *repo_config = have_git_dir() ? git_pathdup("config") : NULL;
 
        if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK, 0)) {
                ret += git_config_from_file(fn, git_etc_gitconfig(),