submodule--helper: rename compute_submodule_clone_url()

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>

Atharva Raykar committed Aug 10, 2021 at 17:16 UTC de0fcbe0f4987dcaa238daa0d0f9cce17afe0495
1 file changed +6 -6
builtin/submodule--helper.c
+6 -6
@@ -199,7 +199,7 @@ static char *relative_url(const char *remote_url,
199 return strbuf_detach(&sb, NULL);
200 }
201
202 -static char *compute_submodule_clone_url(const char *rel_url, const char *up_path, int quiet)
202 +static char *resolve_relative_url(const char *rel_url, const char *up_path, int quiet)
203 {
204 char *remoteurl, *resolved_url;
205 char *remote = get_default_remote();
@@ -634,7 +634,7 @@ static void init_submodule(const char *path, const char *prefix,
634 if (starts_with_dot_dot_slash(url) ||
635 starts_with_dot_slash(url)) {
636 char *oldurl = url;
637 - url = compute_submodule_clone_url(oldurl, NULL, 0);
637 + url = resolve_relative_url(oldurl, NULL, 0);
638 free(oldurl);
639 }
640
@@ -1355,8 +1355,8 @@ static void sync_submodule(const char *path, const char *prefix,
1355 if (starts_with_dot_dot_slash(sub->url) ||
1356 starts_with_dot_slash(sub->url)) {
1357 char *up_path = get_up_path(path);
1358 - sub_origin_url = compute_submodule_clone_url(sub->url, up_path, 1);
1359 - super_config_url = compute_submodule_clone_url(sub->url, NULL, 1);
1358 + sub_origin_url = resolve_relative_url(sub->url, up_path, 1);
1359 + super_config_url = resolve_relative_url(sub->url, NULL, 1);
1360 free(up_path);
1361 } else {
1362 sub_origin_url = xstrdup(sub->url);
@@ -2098,7 +2098,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
2098 if (repo_config_get_string_tmp(the_repository, sb.buf, &url)) {
2099 if (starts_with_dot_slash(sub->url) ||
2100 starts_with_dot_dot_slash(sub->url)) {
2101 - url = compute_submodule_clone_url(sub->url, NULL, 0);
2101 + url = resolve_relative_url(sub->url, NULL, 0);
2102 need_free_url = 1;
2103 } else
2104 url = sub->url;
@@ -3026,7 +3026,7 @@ static int module_add(int argc, const char **argv, const char *prefix)
3026 "of the working tree"));
3027
3028 /* dereference source url relative to parent's url */
3029 - add_data.realrepo = compute_submodule_clone_url(add_data.repo, NULL, 1);
3029 + add_data.realrepo = resolve_relative_url(add_data.repo, NULL, 1);
3030 } else if (is_dir_sep(add_data.repo[0]) || strchr(add_data.repo, ':')) {
3031 add_data.realrepo = add_data.repo;
3032 } else {