On Sat, Jul 10, 2021 at 01:18:01PM +0530, Atharva Raykar wrote: > +static void show_fetch_remotes(FILE *output, const char *sm_name, const char *git_dir_path) > +{ > + struct child_process cp_remote = CHILD_PROCESS_INIT; > + struct strbuf sb_remote_out = STRBUF_INIT; > + > + cp_remote.git_cmd = 1; > + strvec_pushf(&cp_remote.env_array, > + "GIT_DIR=%s", git_dir_path); > + strvec_push(&cp_remote.env_array, "GIT_WORK_TREE=."); > + strvec_pushl(&cp_remote.args, "remote", "-v", NULL); > + if (!capture_command(&cp_remote, &sb_remote_out, 0)) { > + char *next_line; > + char *line = sb_remote_out.buf; > + while ((next_line = strchr(line, '\n')) != NULL) { > + size_t len = next_line - line; > + if (strip_suffix_mem(line, &len, " (fetch)")) > + fprintf(output, " %.*s\n", (int)len, line); > + line = next_line + 1; > + } > + } > + > + strbuf_release(&sb_remote_out); > +} The sm_name parameter is not used here. I don't think it's a bug; we just don't need it (there's a message that mentions the name, but it happens right before we call the function). Maybe this should go on top of ar/submodule-add? -- >8 -- Subject: submodule: drop unused sm_name parameter from show_fetch_remotes() This parameter has not been used since the function was introduced in 8c8195e9c3 (submodule--helper: introduce add-clone subcommand, 2021-07-10). Signed-off-by: Jeff King <peff@xxxxxxxx> --- builtin/submodule--helper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index ed4a50c78e..1e65ff599e 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2782,7 +2782,7 @@ struct add_data { }; #define ADD_DATA_INIT { .depth = -1 } -static void show_fetch_remotes(FILE *output, const char *sm_name, const char *git_dir_path) +static void show_fetch_remotes(FILE *output, const char *git_dir_path) { struct child_process cp_remote = CHILD_PROCESS_INIT; struct strbuf sb_remote_out = STRBUF_INIT; @@ -2833,8 +2833,7 @@ static int add_submodule(const struct add_data *add_data) fprintf(stderr, _("A git directory for '%s' is found " "locally with remote(s):"), add_data->sm_name); - show_fetch_remotes(stderr, add_data->sm_name, - submod_gitdir_path); + show_fetch_remotes(stderr, submod_gitdir_path); free(submod_gitdir_path); die(_("If you want to reuse this local git " "directory instead of cloning again from\n" -- 2.32.0.784.g92e169d3d7