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:

committed by
Junio C Hamano

parent
f793b895fd
commit
3b8fb393bc
@ -455,7 +455,7 @@ static void init_submodule(const char *path, const char *prefix,
|
||||
|
||||
displaypath = get_submodule_displaypath(path, prefix);
|
||||
|
||||
sub = submodule_from_path(&null_oid, path);
|
||||
sub = submodule_from_path(the_repository, &null_oid, path);
|
||||
|
||||
if (!sub)
|
||||
die(_("No url found for submodule path '%s' in .gitmodules"),
|
||||
@ -622,7 +622,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
|
||||
struct rev_info rev;
|
||||
int diff_files_result;
|
||||
|
||||
if (!submodule_from_path(&null_oid, path))
|
||||
if (!submodule_from_path(the_repository, &null_oid, path))
|
||||
die(_("no submodule mapping found in .gitmodules for path '%s'"),
|
||||
path);
|
||||
|
||||
@ -742,7 +742,7 @@ static int module_name(int argc, const char **argv, const char *prefix)
|
||||
if (argc != 2)
|
||||
usage(_("git submodule--helper name <path>"));
|
||||
|
||||
sub = submodule_from_path(&null_oid, argv[1]);
|
||||
sub = submodule_from_path(the_repository, &null_oid, argv[1]);
|
||||
|
||||
if (!sub)
|
||||
die(_("no submodule mapping found in .gitmodules for path '%s'"),
|
||||
@ -773,7 +773,7 @@ static void sync_submodule(const char *path, const char *prefix,
|
||||
if (!is_submodule_active(the_repository, path))
|
||||
return;
|
||||
|
||||
sub = submodule_from_path(&null_oid, path);
|
||||
sub = submodule_from_path(the_repository, &null_oid, path);
|
||||
|
||||
if (sub && sub->url) {
|
||||
if (starts_with_dot_dot_slash(sub->url) ||
|
||||
@ -926,7 +926,7 @@ static void deinit_submodule(const char *path, const char *prefix,
|
||||
struct strbuf sb_config = STRBUF_INIT;
|
||||
char *sub_git_dir = xstrfmt("%s/.git", path);
|
||||
|
||||
sub = submodule_from_path(&null_oid, path);
|
||||
sub = submodule_from_path(the_repository, &null_oid, path);
|
||||
|
||||
if (!sub || !sub->name)
|
||||
goto cleanup;
|
||||
@ -1368,7 +1368,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
sub = submodule_from_path(&null_oid, ce->name);
|
||||
sub = submodule_from_path(the_repository, &null_oid, ce->name);
|
||||
|
||||
if (suc->recursive_prefix)
|
||||
displaypath = relative_path(suc->recursive_prefix,
|
||||
@ -1651,7 +1651,7 @@ static const char *remote_submodule_branch(const char *path)
|
||||
const char *branch = NULL;
|
||||
char *key;
|
||||
|
||||
sub = submodule_from_path(&null_oid, path);
|
||||
sub = submodule_from_path(the_repository, &null_oid, path);
|
||||
if (!sub)
|
||||
return NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user