submodule-config: store the_submodule_cache in the_repository

Refactor how 'the_submodule_cache' is handled so that it can be stored
inside of a repository object.  Also migrate 'the_submodule_cache' to be
stored in 'the_repository'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brandon Williams
2017-06-22 11:43:44 -07:00
committed by Junio C Hamano
parent 639e30b5b2
commit bf12fcdf5e
4 changed files with 72 additions and 18 deletions

View File

@ -1,6 +1,7 @@
#include "cache.h"
#include "repository.h"
#include "config.h"
#include "submodule-config.h"
/* The main repository */
static struct repository the_repo;
@ -164,6 +165,11 @@ void repo_clear(struct repository *repo)
repo->config = NULL;
}
if (repo->submodule_cache) {
submodule_cache_free(repo->submodule_cache);
repo->submodule_cache = NULL;
}
if (repo->index) {
discard_index(repo->index);
free(repo->index);