Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/config.c b/config.c
index bd286b3e36..eb7e310a11 100644
--- a/config.c
+++ b/config.c
@@ -1503,6 +1503,31 @@ static void configset_iter(struct config_set *cs, config_fn_t fn, void *data)
}
}
+void read_early_config(config_fn_t cb, void *data)
+{
+ struct strbuf buf = STRBUF_INIT;
+
+ git_config_with_options(cb, data, NULL, 1);
+
+ /*
+ * When setup_git_directory() was not yet asked to discover the
+ * GIT_DIR, we ask discover_git_directory() to figure out whether there
+ * is any repository config we should use (but unlike
+ * setup_git_directory_gently(), no global state is changed, most
+ * notably, the current working directory is still the same after the
+ * call).
+ */
+ if (!have_git_dir() && discover_git_directory(&buf)) {
+ struct git_config_source repo_config;
+
+ memset(&repo_config, 0, sizeof(repo_config));
+ strbuf_addstr(&buf, "/config");
+ repo_config.file = buf.buf;
+ git_config_with_options(cb, data, &repo_config, 1);
+ }
+ strbuf_release(&buf);
+}
+
static void git_config_check_init(void);
void git_config(config_fn_t fn, void *data)