[PATCH 5/6] submodule: move get_default_remote_submodule()
- From
Jacob Keller <jacob.e.keller@intel.com>
- Date
- Jun 11, 2025, 00:52 UTC
- Message-ID
- <20250610-jk-submodule-helper-use-url-v1-5-6d14c1504e91@gmail.com>
- In-Reply-To
- <20250610-jk-submodule-helper-use-url-v1-0-6d14c1504e91@gmail.com>
From: Jacob Keller <jacob.keller@gmail.com>
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 <jacob.keller@gmail.com> --- builtin/submodule--helper.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index ef3ff65a80f398c5ac35660288290ad92c7132c7..5542b403217b979d6da92c79d89d0991e980f692 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -60,21 +60,6 @@ static int repo_get_default_remote(struct repository *repo, char **default_remot return 0; } -static int get_default_remote_submodule(const char *module_path, char **default_remote) -{ - struct repository subrepo; - int ret; - - if (repo_submodule_init(&subrepo, the_repository, module_path, - null_oid(the_hash_algo)) < 0) - return die_message(_("could not get a repository handle for submodule '%s'"), - module_path); - ret = repo_get_default_remote(&subrepo, default_remote); - repo_clear(&subrepo); - - return ret; -} - static char *get_default_remote(void) { char *default_remote; @@ -110,6 +95,21 @@ static char *resolve_relative_url(const char *rel_url, const char *up_path, int return resolved_url; } +static int get_default_remote_submodule(const char *module_path, char **default_remote) +{ + struct repository subrepo; + int ret; + + if (repo_submodule_init(&subrepo, the_repository, module_path, + null_oid(the_hash_algo)) < 0) + return die_message(_("could not get a repository handle for submodule '%s'"), + module_path); + ret = repo_get_default_remote(&subrepo, default_remote); + repo_clear(&subrepo); + + return ret; +} + /* the result should be freed by the caller. */ static char *get_submodule_displaypath(const char *path, const char *prefix, const char *super_prefix)
-- 2.48.1.397.gec9d649cc640