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

@ -48,9 +48,11 @@ int cmd_main(int argc, const char **argv)
die_usage(argc, argv, "Commit not found.");
if (lookup_name) {
submodule = submodule_from_name(&commit_oid, path_or_name);
submodule = submodule_from_name(the_repository,
&commit_oid, path_or_name);
} else
submodule = submodule_from_path(&commit_oid, path_or_name);
submodule = submodule_from_path(the_repository,
&commit_oid, path_or_name);
if (!submodule)
die_usage(argc, argv, "Submodule not found.");