diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-05-08 09:59:17 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-08 09:59:17 +0300 |
commit | 0c7ecb7c311d393db41f4d81a113ffc5f3b4498f (patch) | |
tree | 1b96e0dd82a0396aa205637d120ab1caac74fbe3 /submodule-config.c | |
parent | 92034a9cd5e71cf686ef66029433bdaba75027b0 (diff) | |
parent | da62f786d2df60f3c8255cf4cbbcd9c1f9458d99 (diff) |
Merge branch 'sb/submodule-move-nested'
Moving a submodule that itself has submodule in it with "git mv"
forgot to make necessary adjustment to the nested sub-submodules;
now the codepath learned to recurse into the submodules.
* sb/submodule-move-nested:
submodule: fixup nested submodules after moving the submodule
submodule-config: remove submodule_from_cache
submodule-config: add repository argument to submodule_from_{name, path}
submodule-config: allow submodule_free to handle arbitrary repositories
grep: remove "repo" arg from non-supporting funcs
submodule.h: drop declaration of connect_work_tree_and_git_dir
Diffstat (limited to 'submodule-config.c')
-rw-r--r-- | submodule-config.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/submodule-config.c b/submodule-config.c index 3f2075764f..d87c3ff63a 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -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); } |