aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
authorJacob Keller <jacob.keller@gmail.com>2025-06-23 16:11:34 -0700
committerJunio C Hamano <gitster@pobox.com>2025-06-23 16:38:57 -0700
commitfedfb0735b2d2dd7b47287925ad5a0aa4fbb9712 (patch)
tree0c4b5d56d881680507b31e164c31a78db0c12681 /builtin/submodule--helper.c
parente759275c8fbf76e380600a87f72d6857d3b48ba3 (diff)
downloadgit-fedfb0735b2d2dd7b47287925ad5a0aa4fbb9712.tar.gz
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 <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 4aa237033a..1aa87435c2 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -41,22 +41,6 @@
typedef void (*each_submodule_fn)(const struct cache_entry *list_item,
void *cb_data);
-static int get_default_remote_submodule(const char *module_path, char **default_remote)
-{
- struct repository subrepo;
-
- 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);
-
- *default_remote = xstrdup(repo_default_remote(&subrepo));
-
- repo_clear(&subrepo);
-
- return 0;
-}
-
static char *get_default_remote(void)
{
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
return resolved_url;
}
+static int get_default_remote_submodule(const char *module_path, char **default_remote)
+{
+ struct repository subrepo;
+
+ 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);
+
+ *default_remote = xstrdup(repo_default_remote(&subrepo));
+
+ repo_clear(&subrepo);
+
+ return 0;
+}
+
/* the result should be freed by the caller. */
static char *get_submodule_displaypath(const char *path, const char *prefix,
const char *super_prefix)