Subject: Re: [PATCH] add-patch: roll over to next undecided hunk

From: Junio C Hamano <[email-masked]>
Date: Fri, 03 Oct 2025 13:42:49 -0700

René Scharfe <[email-masked]> writes:

> On 10/3/25 6:11 PM, Junio C Hamano wrote:
>> René Scharfe <[email-masked]> writes:
>> 
>>> git add --patch presents diff hunks one after the other, asking whether
>>> to add them.  If we mark some as undecided, e.g. with J, then it will
>> 
>> Perhaps "mark" -> "leave".
>> 
>> I somehow find it awkward to say "mark as undecided", as I have
>> always viewed J/K as a way to skip a hunk, leaving it undecided.
>> 
>> Besides, "J" lets you revisit a hunk that you earlier have decided
>> to use of hold off, and it leaves your last decision on that hunk.
>> A statement that implies "J marks as undecided" is misleading.
>
> Right, j/J/k/K leave the use/skip/undecided status of the current hunk
> unchanged.

Yes.  If the one you are walking away with 'J' were already
selected, the scenario you describe in the proposed log message
would not work, so "mark" -> "leave" is the right thing to do in
that context.  But ...

> "leave this hunk undecided" in the documentation is
> misleading as well, because these options will not leave a hunk
> undecided if we made a decision on it before:

... as you say, I agree that your updated version

>                j - go to next undecided hunk
>                J - go to next hunk
>                k - go to previous undecided hunk
>                K - go to previous hunk

in the documentation or help would be a good change.

> Weird that one can switch between use and skip, but there's no
> way to revert back to undecided.

Another thing that is missing (and these two are not a regression in
the C version, but the same in my scripted original) is that once
you decided on _all_ hunks of a file, there is no way to come back
and tell the tool that you changed your mind.