]> git.ipfire.org Git - thirdparty/git.git/commitdiff
submodule--helper: rename compute_submodule_clone_url()
authorAtharva Raykar <raykar.ath@gmail.com>
Tue, 10 Aug 2021 11:46:41 +0000 (17:16 +0530)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Aug 2021 18:45:12 +0000 (11:45 -0700)
Let's rename 'compute_submodule_clone_url()' to 'resolve_relative_url()'
to make it clear that this internal helper need not be used exclusively
for computing submodule clone URLs.

Since the original 'resolve-relative-url' subcommand and its C entry
point has been removed in c461095ae3 (submodule--helper: remove
resolve-relative-url subcommand, 2021-07-02), this rename can be done
without causing any confusion about which function it actually binds to.

Signed-off-by: Atharva Raykar <raykar.ath@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Shourya Shukla <periperidip@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c

index 9d450b586081911853a2be87f29212a1c6b13492..c9ec03964b819bc1b7bed9df4fec88a0ede8c512 100644 (file)
@@ -199,7 +199,7 @@ static char *relative_url(const char *remote_url,
        return strbuf_detach(&sb, NULL);
 }
 
-static char *compute_submodule_clone_url(const char *rel_url, const char *up_path, int quiet)
+static char *resolve_relative_url(const char *rel_url, const char *up_path, int quiet)
 {
        char *remoteurl, *resolved_url;
        char *remote = get_default_remote();
@@ -634,7 +634,7 @@ static void init_submodule(const char *path, const char *prefix,
                if (starts_with_dot_dot_slash(url) ||
                    starts_with_dot_slash(url)) {
                        char *oldurl = url;
-                       url = compute_submodule_clone_url(oldurl, NULL, 0);
+                       url = resolve_relative_url(oldurl, NULL, 0);
                        free(oldurl);
                }
 
@@ -1355,8 +1355,8 @@ static void sync_submodule(const char *path, const char *prefix,
                if (starts_with_dot_dot_slash(sub->url) ||
                    starts_with_dot_slash(sub->url)) {
                        char *up_path = get_up_path(path);
-                       sub_origin_url = compute_submodule_clone_url(sub->url, up_path, 1);
-                       super_config_url = compute_submodule_clone_url(sub->url, NULL, 1);
+                       sub_origin_url = resolve_relative_url(sub->url, up_path, 1);
+                       super_config_url = resolve_relative_url(sub->url, NULL, 1);
                        free(up_path);
                } else {
                        sub_origin_url = xstrdup(sub->url);
@@ -2098,7 +2098,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
        if (repo_config_get_string_tmp(the_repository, sb.buf, &url)) {
                if (starts_with_dot_slash(sub->url) ||
                    starts_with_dot_dot_slash(sub->url)) {
-                       url = compute_submodule_clone_url(sub->url, NULL, 0);
+                       url = resolve_relative_url(sub->url, NULL, 0);
                        need_free_url = 1;
                } else
                        url = sub->url;
@@ -3026,7 +3026,7 @@ static int module_add(int argc, const char **argv, const char *prefix)
                              "of the working tree"));
 
                /* dereference source url relative to parent's url */
-               add_data.realrepo = compute_submodule_clone_url(add_data.repo, NULL, 1);
+               add_data.realrepo = resolve_relative_url(add_data.repo, NULL, 1);
        } else if (is_dir_sep(add_data.repo[0]) || strchr(add_data.repo, ':')) {
                add_data.realrepo = add_data.repo;
        } else {