Skip to content

Commit de0fcbe

Browse files
tfidfwastakengitster
authored andcommitted
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 <[email protected]> Mentored-by: Christian Couder <[email protected]> Mentored-by: Shourya Shukla <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 15fe88d commit de0fcbe

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

builtin/submodule--helper.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static char *relative_url(const char *remote_url,
199199
return strbuf_detach(&sb, NULL);
200200
}
201201

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)
203203
{
204204
char *remoteurl, *resolved_url;
205205
char *remote = get_default_remote();
@@ -634,7 +634,7 @@ static void init_submodule(const char *path, const char *prefix,
634634
if (starts_with_dot_dot_slash(url) ||
635635
starts_with_dot_slash(url)) {
636636
char *oldurl = url;
637-
url = compute_submodule_clone_url(oldurl, NULL, 0);
637+
url = resolve_relative_url(oldurl, NULL, 0);
638638
free(oldurl);
639639
}
640640

@@ -1355,8 +1355,8 @@ static void sync_submodule(const char *path, const char *prefix,
13551355
if (starts_with_dot_dot_slash(sub->url) ||
13561356
starts_with_dot_slash(sub->url)) {
13571357
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);
13601360
free(up_path);
13611361
} else {
13621362
sub_origin_url = xstrdup(sub->url);
@@ -2098,7 +2098,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
20982098
if (repo_config_get_string_tmp(the_repository, sb.buf, &url)) {
20992099
if (starts_with_dot_slash(sub->url) ||
21002100
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);
21022102
need_free_url = 1;
21032103
} else
21042104
url = sub->url;
@@ -3026,7 +3026,7 @@ static int module_add(int argc, const char **argv, const char *prefix)
30263026
"of the working tree"));
30273027

30283028
/* 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);
30303030
} else if (is_dir_sep(add_data.repo[0]) || strchr(add_data.repo, ':')) {
30313031
add_data.realrepo = add_data.repo;
30323032
} else {

0 commit comments

Comments
 (0)