]> Kevux Git Server - rit/commit
add-patch: let options y, n, j, and e roll over to next undecided
authorRené Scharfe <l.s.r@web.de>
Mon, 6 Oct 2025 17:21:19 +0000 (19:21 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Oct 2025 17:51:42 +0000 (10:51 -0700)
commit171c1688ccbe5e6d709444a65a5ca2e0a9175b16
tree529b36bec399916d42fc2a8cec02e1c0d55e2746
parentc309b65a7c8a0dc8a1566ac3587d37d935632e4d
add-patch: let options y, n, j, and e roll over to next undecided

The options y, n, and e mark the current hunk as decided.  If there's
another undecided hunk towards the bottom of the hunk array they go
there.  If there isn't, but there is another undecided hunk towards the
top then they go to the very first hunk, no matter if it has already
been decided on.

The option j does basically the same move.  Technically it is not
allowed if there's no undecided hunk towards the bottom, but the
variable "permitted" is never reset, so this permission is retained
from the very first hunk.  That may a bug, but this behavior is at
least consistent with y, n, and e and arguably more useful than
refusing to move.

Improve the roll-over behavior of these four options by moving to the
first undecided hunk instead of hunk 1, consistent with what they do
when not rolling over.

Also adjust the error message for j, as it will only be shown if
there's no other undecided hunk in either direction.

Reported-by: Windl, Ulrich <u.windl@ukr.de>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-add.adoc
add-patch.c
t/t3701-add-interactive.sh