]> git.ipfire.org Git - thirdparty/git.git/commit
add -p: mark split hunks as undecided
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Thu, 25 Sep 2025 15:10:37 +0000 (15:10 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Sep 2025 17:13:22 +0000 (10:13 -0700)
commit3b9532dab2fe1db12d5a33c74a0256d03a4c4861
tree77e9a1a042c901c81825ffe4da2b44f7c9423719
parent92c87bdc406e5bcf1b516a861d609b03d99c23b7
add -p: mark split hunks as undecided

When a hunk is split, each of the new hunks inherits whether it is
selected or not from the original hunk. If a selected hunk is split
all of the new hunks are marked as "selected" and the user is only
prompted with the first of the split hunks. The user is not asked
whether or not they wish to select the rest of the new hunks. This
means that if they wish to deselect any of the new hunks apart from
the first one they have to navigate back to the hunk they want to
deselect before they can deselect it. This is unfortunate as the user
is presumably splitting the original hunk because they only want to
select some sub-set of it.

Instead mark all the new hunks as "undecided" so that the user is
prompted whether they wish to select each one in turn. In the case
where the user only wants to change the selection of the first of
the split hunks they will now have to do more work re-selecting the
remaining split hunks. However, changing the selection of any of the
other newly created hunks is now much simpler as the user no-longer has
to navigate back to them in order to change their selected state.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
add-patch.c
t/t3701-add-interactive.sh