aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-08-22 10:29:01 -0700
committerJunio C Hamano <gitster@pobox.com>2017-08-22 10:29:01 -0700
commit5aa0b6c506c1f1336d0e713bf8225509e9ebb9f5 (patch)
treea0eaaf3110e43b2a4aec5f7023fbf62a655418de /config.c
parent1016495a7190911b37c354f7a985278c51ae6666 (diff)
parentf9ee2fcdfa05586b6a4476c7aa5f4f0162e48455 (diff)
downloadgit-5aa0b6c506c1f1336d0e713bf8225509e9ebb9f5.tar.gz
git-5aa0b6c506c1f1336d0e713bf8225509e9ebb9f5.tar.xz
Merge branch 'bw/grep-recurse-submodules'
"git grep --recurse-submodules" has been reworked to give a more consistent output across submodule boundary (and do its thing without having to fork a separate process). * bw/grep-recurse-submodules: grep: recurse in-process using 'struct repository' submodule: merge repo_read_gitmodules and gitmodules_config submodule: check for unmerged .gitmodules outside of config parsing submodule: check for unstaged .gitmodules outside of config parsing submodule: remove fetch.recursesubmodules from submodule-config parsing submodule: remove submodule.fetchjobs from submodule-config parsing config: add config_from_gitmodules cache.h: add GITMODULES_FILE macro repository: have the_repository use the_index repo_read_index: don't discard the index
Diffstat (limited to 'config.c')
-rw-r--r--config.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/config.c b/config.c
index 9ec8c4488..c1450732d 100644
--- a/config.c
+++ b/config.c
@@ -2059,6 +2059,23 @@ int git_config_get_pathname(const char *key, const char **dest)
return repo_config_get_pathname(the_repository, key, dest);
}
+/*
+ * Note: This function exists solely to maintain backward compatibility with
+ * 'fetch' and 'update_clone' storing configuration in '.gitmodules' and should
+ * NOT be used anywhere else.
+ *
+ * Runs the provided config function on the '.gitmodules' file found in the
+ * working directory.
+ */
+void config_from_gitmodules(config_fn_t fn, void *data)
+{
+ if (the_repository->worktree) {
+ char *file = repo_worktree_path(the_repository, GITMODULES_FILE);
+ git_config_from_file(fn, file, data);
+ free(file);
+ }
+}
+
int git_config_get_expiry(const char *key, const char **output)
{
int ret = git_config_get_string_const(key, output);