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>
This commit is contained in:
Brandon Williams
2016-12-16 11:03:18 -08:00
committed by Junio C Hamano
parent f9f42560e2
commit 9ebf689aad
6 changed files with 25 additions and 7 deletions

View File

@ -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'
*/