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 <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Glen Choo committed
Jun 30, 2022 at 19:11 UTC
5ad87271cfab6edb8eb6ad736747cd1a4f42bf83
1 file changed
+8
-16
builtin/submodule--helper.c
+8
-16
@@ -118,10 +118,11 @@ static int resolve_relative_url_test(int argc, const char **argv, const char *pr
118
return 0;
119
}
120
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)
123
{
124
+ const char *super_prefix = get_super_prefix();
125
+
126
if (prefix && super_prefix) {
127
BUG("cannot have prefix '%s' and superprefix '%s'",
128
prefix, super_prefix);
@@ -137,13 +138,6 @@ static char *do_get_submodule_displaypath(const char *path,
138
}
139
}
140
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
-
141
static char *compute_rev_name(const char *sub_path, const char* object_id)
142
{
143
struct strbuf sb = STRBUF_INIT;
@@ -488,7 +482,7 @@ static void init_submodule(const char *path, const char *prefix,
482
struct strbuf sb = STRBUF_INIT;
483
char *upd = NULL, *url = NULL, *displaypath;
484
491
- displaypath = do_get_submodule_displaypath(path, prefix, get_super_prefix());
485
+ displaypath = get_submodule_displaypath(path, prefix);
486
487
sub = submodule_from_path(the_repository, null_oid(), path);
488
@@ -1943,8 +1937,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
1937
enum submodule_update_type update_type;
1938
char *key;
1939
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);
1941
struct strbuf sb = STRBUF_INIT;
1942
int needs_cloning = 0;
1943
int need_free_url = 0;
@@ -2461,9 +2454,8 @@ static int update_submodule(struct update_data *update_data)
2454
{
2455
ensure_core_worktree(update_data->sm_path);
2456
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);
2459
2460
determine_submodule_update_strategy(the_repository, update_data->just_cloned,
2461
update_data->sm_path, update_data->update_default,