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
This commit is contained in:
Junio C Hamano
2018-05-08 15:59:17 +09:00
15 changed files with 140 additions and 79 deletions

View File

@ -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);
}