submodule-config: add repository argument to submodule_from_{name, path}

This enables submodule_from_{name, path} to handle arbitrary repositories.
All callers just pass in the_repository, a later patch will pass in other
repos.

While at it remove the extern key word from the declarations.

Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller
2018-03-28 15:35:29 -07:00
committed by Junio C Hamano
parent f793b895fd
commit 3b8fb393bc
5 changed files with 41 additions and 33 deletions

View File

@ -619,18 +619,20 @@ 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,