Subject: Re: [PATCH 09/13] submodule--helper: remove update-module-mode subcommand

From: Atharva Raykar <[email-masked]>
Date: Tue, 07 Sep 2021 19:20:18 +0530

Ævar Arnfjörð Bjarmason <[email-masked]> writes:

> On Tue, Sep 07 2021, Atharva Raykar wrote:
>
>> This subcommand was once useful for 'submodule update', but now that we
>> have converted the shell code to C, it is no longer used.
>>
>> Mentored-by: Christian Couder <[email-masked]>
>> Mentored-by: Shourya Shukla <[email-masked]>
>> Signed-off-by: Atharva Raykar <[email-masked]>
>> ---
>>  builtin/submodule--helper.c | 24 ------------------------
>>  1 file changed, 24 deletions(-)
>>
>> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
>> index a628660d6b..e3e85600c3 100644
>> --- a/builtin/submodule--helper.c
>> +++ b/builtin/submodule--helper.c
>> @@ -1993,29 +1993,6 @@ static void determine_submodule_update_strategy(struct repository *r,
>>  	free(key);
>>  }
>>
>> -static int module_update_module_mode(int argc, const char **argv, const char *prefix)
>> -{
>> -	const char *path, *update = NULL;
>> -	int just_cloned;
>> -	struct submodule_update_strategy update_strategy = { .type = SM_UPDATE_CHECKOUT };
>> -
>> -	if (argc < 3 || argc > 4)
>> -		die("submodule--helper update-module-clone expects <just-cloned> <path> [<update>]");
>> -
>> -	just_cloned = git_config_int("just_cloned", argv[1]);
>> -	path = argv[2];
>> -
>> -	if (argc == 4)
>> -		update = argv[3];
>> -
>> -	determine_submodule_update_strategy(the_repository,
>> -					    just_cloned, path, update,
>> -					    &update_strategy);
>> -	fputs(submodule_strategy_to_string(&update_strategy), stdout);
>> -
>> -	return 0;
>> -}
>> -
>>  struct update_clone_data {
>>  	const struct submodule *sub;
>>  	struct object_id oid;
>> @@ -3463,7 +3440,6 @@ static struct cmd_struct commands[] = {
>>  	{"clone", module_clone, 0},
>>  	{"add-clone", add_clone, 0},
>>  	{"update", module_update, 0},
>> -	{"update-module-mode", module_update_module_mode, 0},
>>  	{"run-update-procedure", run_update_procedure, 0},
>>  	{"ensure-core-worktree", ensure_core_worktree, 0},
>>  	{"relative-path", resolve_relative_path, 0},
>
> So in https://lore.kernel.org/git/[email-masked] I
> suggested squashing the shell removal, but I see now that here later in
> 09-13/13.
>
> So yeah, having 08/13 stand-alone is easier to read then, but I think
> then squashing all of 09-13 together is better. I.e. there's no reason
> to remove these one at a time, let's just remove them all at once.

Okay, I shall do this.

> That also makes it clear that it's a remove-only change aside from your
> "refactor while at it" of renaming this function:
>
>     -static int do_run_update_procedure(struct update_data *ud, struct string_list *err)
>     +static int run_update_procedure(struct update_data *ud, struct string_list *err)
>
> We could either skip that, or split that later refactoring into another
> commit.
>
> Thanks for working on this, I'm exciting to see more of git-submodule.sh
> go away. Hopefully these comments I left are useful / will aid future
> reviewer readability of this series.

Thanks for your suggestions. I've gone through all of them, and I'll
reroll soon.