diff options
Diffstat (limited to 'submodule-config.c')
-rw-r--r-- | submodule-config.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/submodule-config.c b/submodule-config.c index 2aa8a1747f..d87c3ff63a 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -9,7 +9,7 @@ /* * submodule cache lookup structure * There is one shared set of 'struct submodule' entries which can be - * looked up by their sha1 blob id of the .gitmodule file and either + * looked up by their sha1 blob id of the .gitmodules file and either * using path or name as key. * for_path stores submodule entries with path as key * for_name stores submodule entries with name as key @@ -91,7 +91,7 @@ static void submodule_cache_clear(struct submodule_cache *cache) /* * We iterate over the name hash here to be symmetric with the * allocation of struct submodule entries. Each is allocated by - * their .gitmodule blob sha1 and submodule name. + * their .gitmodules blob sha1 and submodule name. */ hashmap_iter_init(&cache->for_name, &iter); while ((entry = hashmap_iter_next(&iter))) @@ -520,7 +520,7 @@ static const struct submodule *config_from(struct submodule_cache *cache, if (submodule) goto out; - config = read_sha1_file(oid.hash, &type, &config_size); + config = read_object_file(&oid, &type, &config_size); if (!config || type != OBJ_BLOB) goto out; @@ -619,31 +619,24 @@ static void gitmodules_read_check(struct repository *repo) repo_read_gitmodules(repo); } -const struct submodule *submodule_from_name(const struct object_id *treeish_name, +const struct submodule *submodule_from_name(struct repository *r, + const struct object_id *treeish_name, const char *name) { - gitmodules_read_check(the_repository); - return config_from(the_repository->submodule_cache, treeish_name, name, lookup_name); + gitmodules_read_check(r); + return config_from(r->submodule_cache, treeish_name, name, lookup_name); } -const struct submodule *submodule_from_path(const struct object_id *treeish_name, +const struct submodule *submodule_from_path(struct repository *r, + const struct object_id *treeish_name, const char *path) { - gitmodules_read_check(the_repository); - return config_from(the_repository->submodule_cache, treeish_name, path, lookup_path); + gitmodules_read_check(r); + return config_from(r->submodule_cache, treeish_name, path, lookup_path); } -const struct submodule *submodule_from_cache(struct repository *repo, - const struct object_id *treeish_name, - const char *key) +void submodule_free(struct repository *r) { - gitmodules_read_check(repo); - return config_from(repo->submodule_cache, treeish_name, - key, lookup_path); -} - -void submodule_free(void) -{ - if (the_repository->submodule_cache) - submodule_cache_clear(the_repository->submodule_cache); + if (r->submodule_cache) + submodule_cache_clear(r->submodule_cache); } |