Subject: Re: [PATCH 3/3] add-interactive: add new "context" subcommand

From: Junio C Hamano <[email-masked]>
Date: Tue, 06 May 2025 09:37:31 -0700

Eric Sunshine <[email-masked]> writes:

> On Mon, May 5, 2025 at 5:19 AM Leon Michalak via GitGitGadget
> <[email-masked]> wrote:
>> This teaches `add/commit --interactive` a new "context" subcommand, which
>> changes the amount of context lines subsequent subcommands like "patch"
>> or "diff" generate in their diffs.
>>
>> Signed-off-by: Leon Michalak <[email-masked]>
>> ---
>> diff --git a/Documentation/git-add.adoc b/Documentation/git-add.adoc
>> @@ -265,14 +265,15 @@ and type return, like this:
>>  ------------
>>      *** Commands ***
>>        1: status       2: update       3: revert       4: add untracked
>> -      5: patch        6: diff         7: quit         8: help
>> +      5: patch        6: diff         7: context      8: quit
>> +      9: help
>>      What now> 1
>
> I'm not a `git add/commit --interactive' user, but I can imagine that
> inserting "context" at 7 and bumping "quit" and "help" to 8 and 9,
> respectively, is going to play havoc with muscle memory people have
> built up over the years. To make this more friendly for existing
> users, I'd suggest adding this new command at the end of the list
> without changing the existing command numbers.

Hmph, in the real UI, the first letters of these commands (which
have deliberately been chosen to be unique) are shown in different
color to hint that the answer to the prompt can be like 's' (for
status).  I would hate to see that quit/help, which are somewhat
special, move from the very end position.

Perhaps the example of the documentation page shown above should
respond with 's', not '1' to show more prominently that it is
possible and encouraged?  I dunno.

> Also, looking at this list, I can't help but think that "context"
> feels out of place among the other action-oriented commands. Moreover,
> if --interactive mode grows more configuration/setting-like commands
> in the future, do we really want to keep extending this menu for them?

That is a valid concern.

> Specifically, I'm wondering if it would instead make sense to
> introduce a new item "9: settings" which takes the user to a
> "Settings" submenu from which the number of context lines can be set.

's' is taken for 'status', so it shouldn't be '9: settings' (it
should come before 'quit' instead), but I think I know where you are
going.

An alternative that may work better is to allow subcommand specific
parameters in the answer to the "What now>" prompt, e.g.

	What now> r -U7

to choose an equivalent to "git revert -p -U7".

Thanks.