Skip to content

Commit 5ad8727

Browse files
chooglengitster
authored andcommitted
submodule--helper: remove display path helper
All invocations of do_get_submodule_displaypath() pass get_super_prefix() as the super_prefix arg, which is exactly the same as get_submodule_displaypath(). Replace all calls to do_get_submodule_displaypath() with get_submodule_displaypath(), and since it has no more callers, remove it. Signed-off-by: Glen Choo <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d7a714f commit 5ad8727

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

builtin/submodule--helper.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,11 @@ static int resolve_relative_url_test(int argc, const char **argv, const char *pr
118118
return 0;
119119
}
120120

121-
static char *do_get_submodule_displaypath(const char *path,
122-
const char *prefix,
123-
const char *super_prefix)
121+
/* the result should be freed by the caller. */
122+
static char *get_submodule_displaypath(const char *path, const char *prefix)
124123
{
124+
const char *super_prefix = get_super_prefix();
125+
125126
if (prefix && super_prefix) {
126127
BUG("cannot have prefix '%s' and superprefix '%s'",
127128
prefix, super_prefix);
@@ -137,13 +138,6 @@ static char *do_get_submodule_displaypath(const char *path,
137138
}
138139
}
139140

140-
/* the result should be freed by the caller. */
141-
static char *get_submodule_displaypath(const char *path, const char *prefix)
142-
{
143-
const char *super_prefix = get_super_prefix();
144-
return do_get_submodule_displaypath(path, prefix, super_prefix);
145-
}
146-
147141
static char *compute_rev_name(const char *sub_path, const char* object_id)
148142
{
149143
struct strbuf sb = STRBUF_INIT;
@@ -488,7 +482,7 @@ static void init_submodule(const char *path, const char *prefix,
488482
struct strbuf sb = STRBUF_INIT;
489483
char *upd = NULL, *url = NULL, *displaypath;
490484

491-
displaypath = do_get_submodule_displaypath(path, prefix, get_super_prefix());
485+
displaypath = get_submodule_displaypath(path, prefix);
492486

493487
sub = submodule_from_path(the_repository, null_oid(), path);
494488

@@ -1943,8 +1937,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
19431937
enum submodule_update_type update_type;
19441938
char *key;
19451939
struct update_data *ud = suc->update_data;
1946-
char *displaypath = do_get_submodule_displaypath(ce->name, ud->prefix,
1947-
get_super_prefix());
1940+
char *displaypath = get_submodule_displaypath(ce->name, ud->prefix);
19481941
struct strbuf sb = STRBUF_INIT;
19491942
int needs_cloning = 0;
19501943
int need_free_url = 0;
@@ -2461,9 +2454,8 @@ static int update_submodule(struct update_data *update_data)
24612454
{
24622455
ensure_core_worktree(update_data->sm_path);
24632456

2464-
update_data->displaypath = do_get_submodule_displaypath(update_data->sm_path,
2465-
update_data->prefix,
2466-
get_super_prefix());
2457+
update_data->displaypath = get_submodule_displaypath(
2458+
update_data->sm_path, update_data->prefix);
24672459

24682460
determine_submodule_update_strategy(the_repository, update_data->just_cloned,
24692461
update_data->sm_path, update_data->update_default,

0 commit comments

Comments
 (0)