Skip to content

Commit b645f8f

Browse files
jacob-kellergitster
authored andcommitted
submodule: move get_default_remote_submodule()
A future refactor got get_default_remote_submodule() is going to depend on resolve_relative_url(). That function depends on get_default_remote(). Move get_default_remote_submodule() after resolve_relative_url() first to make the additional functionality easier to review. Signed-off-by: Jacob Keller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8d9ac96 commit b645f8f

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

builtin/submodule--helper.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,6 @@
4141
typedef void (*each_submodule_fn)(const struct cache_entry *list_item,
4242
void *cb_data);
4343

44-
static int get_default_remote_submodule(const char *module_path, char **default_remote)
45-
{
46-
struct repository subrepo;
47-
48-
if (repo_submodule_init(&subrepo, the_repository, module_path,
49-
null_oid(the_hash_algo)) < 0)
50-
return die_message(_("could not get a repository handle for submodule '%s'"),
51-
module_path);
52-
53-
*default_remote = xstrdup(repo_default_remote(&subrepo));
54-
55-
repo_clear(&subrepo);
56-
57-
return 0;
58-
}
59-
6044
static char *get_default_remote(void)
6145
{
6246
return xstrdup(repo_default_remote(the_repository));
@@ -86,6 +70,22 @@ static char *resolve_relative_url(const char *rel_url, const char *up_path, int
8670
return resolved_url;
8771
}
8872

73+
static int get_default_remote_submodule(const char *module_path, char **default_remote)
74+
{
75+
struct repository subrepo;
76+
77+
if (repo_submodule_init(&subrepo, the_repository, module_path,
78+
null_oid(the_hash_algo)) < 0)
79+
return die_message(_("could not get a repository handle for submodule '%s'"),
80+
module_path);
81+
82+
*default_remote = xstrdup(repo_default_remote(&subrepo));
83+
84+
repo_clear(&subrepo);
85+
86+
return 0;
87+
}
88+
8989
/* the result should be freed by the caller. */
9090
static char *get_submodule_displaypath(const char *path, const char *prefix,
9191
const char *super_prefix)

0 commit comments

Comments
 (0)