Issue 2383 Using last regrets/hunk edit can lead to "Error applying" error

Title Using last regrets/hunk edit can lead to "Error applying" error
Priority urgent Status unknown
Milestone Resolved in
Superseder Nosy List owst
Assigned To

Created on 2014-04-29.16:09:47 by owst, last changed 2020-06-21.07:20:09 by bf.

msg17409 (view) Author: owst Date: 2014-04-29.16:09:46
1. Summarise the issue (what were doing, what went wrong?)

I was recording some changes, before noticing at last regrets that I
don't want to include a particular sub-hunk that I've already said yes to.

I have already recorded a file containing:

    -- a comment

    data D = C Int
           deriving (Eq, Show)

which I then change in working to:

    -- another comment

    -- a comment

    data D = C !Int
           deriving (Eq)

Then, in record, I don't record the initial comment-addition, I do
record the final hunk.
I get to last regrets before realising I don't want to remove D's Show
so I put it back using the hunk editor. I accept the remaining changes,
but darcs fails:

    WARNING: Doing a one-time conversion of pristine format.
    This may take a while. The new format is backwards-compatible.
    Pristine conversion done...

    darcs failed:  ### Error applying:
    hunk ./file 5
    -data D = C Int
    -       deriving (Eq, Show)
    +data D = C !Int
    +       deriving (Eq)
    ### to file ./file:
    -- a comment

    data D = C Int
           deriving (Eq, Show)

darcs shouldn't fail, and should record a patch that simply adds a ! to
the Int parameter of C.
msg17410 (view) Author: owst Date: 2014-04-29.16:25:27
And the obvious thing to point out is that the pristine conversion
message is spurious, and any fix of this bug should look into why it's
msg22084 (view) Author: bf Date: 2020-06-21.07:18:54
To my great surprise I can still reproduce this bug.
msg22085 (view) Author: bf Date: 2020-06-21.07:20:07
Indeed we have a failing test case for it.
Date User Action Args
2014-04-29 16:09:47owstcreate
2014-04-29 16:25:28owstsetmessages: + msg17410
2020-06-21 07:18:57bfsetpriority: urgent
messages: + msg22084
2020-06-21 07:20:09bfsetmessages: + msg22085