Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add -p: a couple of hunk splitting fixes #1863

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

phillipwood
Copy link

This series fixes a couple of infelicities when splitting hunks that have already been selected or edited which I noticed a while ago when preparing the test for 'pw/add-patch-with-suppress-blank-empty'.

When a hunk is split each of the new hunks inherits whether it is
selected or not from the original hunk. This means that if a selected
hunk is split all of the new hunks are selected and the user is not asked
whether or not they want to select the new hunks. This is unfortunate as
the user is presumably splitting the original hunk because they only
want to select some sub-set of it. Fix this by marking all the new hunks
as "undecided" so that we prompt the user to decide whether to select
them or not.

Signed-off-by: Phillip Wood <[email protected]>
When the users edits a hunk if they change deletion lines to context
lines or vice versa then the number of hunks that the edited hunk can be
split into may differ from the unedited hunk and so we need to update
hunk->splittable_into. In practice users are unlikely to hit this bug as
it is doubtful that a user who has edited a hunk will split it
afterwards.

Signed-off-by: Phillip Wood <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant