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:
authorBrandon Williams <bmwill@google.com>2017-06-22 21:43:45 +0300
committerJunio C Hamano <gitster@pobox.com>2017-06-24 04:24:34 +0300
commit69aba5329e3464bfe38d2614033e19c490f8694d (patch)
treeeb5584573975b7119ef9bef8d1375d7d3be8b3d1 /submodule.c
parentbf12fcdf5ec00e6b7d0978750df9e0146eb57c75 (diff)
submodule: add repo_read_gitmodules
Teach the repo object to be able to populate the submodule_cache by reading the repository's gitmodules file. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c
index da0b805493..d0b8947726 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "repository.h"
#include "config.h"
#include "submodule-config.h"
#include "submodule.h"
@@ -255,6 +256,20 @@ void gitmodules_config(void)
}
}
+static int gitmodules_cb(const char *var, const char *value, void *data)
+{
+ struct repository *repo = data;
+ return submodule_config_option(repo, var, value);
+}
+
+void repo_read_gitmodules(struct repository *repo)
+{
+ char *gitmodules_path = repo_worktree_path(repo, ".gitmodules");
+
+ git_config_from_file(gitmodules_cb, gitmodules_path, repo);
+ free(gitmodules_path);
+}
+
void gitmodules_config_sha1(const unsigned char *commit_sha1)
{
struct strbuf rev = STRBUF_INIT;