Re: [PATCH 3/3] add-interactive: add new "context" subcommand
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- May 7, 2025, 13:30 UTC
- Message-ID
- <a290bc6f-9198-4a00-8273-2970cfbd4a29@gmail.com>
- In-Reply-To
- <xmqqldr9lmpg.fsf@gitster.g>
On 06/05/2025 17:37, Junio C Hamano wrote:
Show 7 quoted lines
> > 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".
I think the best solution would be to allow users to re-display the current hunk with more context inside "add -p" rather than changing "add -i". That way a user who needs more context to make a decision on the current hunk can get it without restarting the whole process of selecting hunks [1]. If the user knows up front that they want a certain amount of context they can use "git add -p -U <context>" or "git add -i -U <context>" which was added in the preceding patch.
Best Wishes
Phillip
[1] With "git add -p" they can quit and carry on from where they left off but "git stash -p" doesn't let you amend an existing stash and git refuses to pop a stash if the working tree is dirty. This means if a stash is split in two because the user exited to change the context they cannot pop both stashes on top of each other.