summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2016-12-16 19:03:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-22 19:47:33 (GMT)
commit9ebf689aad72bfc091da21e1d73a05308f1ace85 (patch)
treea6977a330a910da0e7760f96a9b1e70d6e3e9f60 /submodule.c
parentf9f42560e2911a5eef9a3d463a63cfd48d54dd07 (diff)
downloadgit-9ebf689aad72bfc091da21e1d73a05308f1ace85.zip
git-9ebf689aad72bfc091da21e1d73a05308f1ace85.tar.gz
git-9ebf689aad72bfc091da21e1d73a05308f1ace85.tar.bz2
submodules: load gitmodules file from commit sha1
teach submodules to load a '.gitmodules' file from a commit sha1. This enables the population of the submodule_cache to be based on the state of the '.gitmodules' file from a particular commit. 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.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c
index edffaa1..2600908 100644
--- a/submodule.c
+++ b/submodule.c
@@ -198,6 +198,18 @@ void gitmodules_config(void)
}
}
+void gitmodules_config_sha1(const unsigned char *commit_sha1)
+{
+ struct strbuf rev = STRBUF_INIT;
+ unsigned char sha1[20];
+
+ if (gitmodule_sha1_from_commit(commit_sha1, sha1, &rev)) {
+ git_config_from_blob_sha1(submodule_config, rev.buf,
+ sha1, NULL);
+ }
+ strbuf_release(&rev);
+}
+
/*
* Determine if a submodule has been initialized at a given 'path'
*/