merge: fix a problem with unmatchable hunks.
If the patch contains hunks that cannot be matched, wiggle cannot to
anything really useful, but sometimes it does something bad and produces
a badly formatted result.
In these cases, the hunk must get placed somewhere, and it is possible
that two hunks could line up with different places in the same line of
the original.
As wiggle normally expands conflicts to cover whole lines, to display
this coherently, you would need something like
<<<
chosen line
||||
hunk1- before
hunk2- before
===
hunk1- after
hunk2- after
>>>
But wiggle assumes that a hunk header marks the end of a conflict, so
bad things happen here.
I don't want to display the hunk header, so I think the best option is
<<<
chosen line
|||
hunk1- before
===
hunk1- after
>>>
<<<
|||
hunk2- before
===
hunk2- after
>>>
To achieve this, we don't stop collecting a conflict when we hit a
hunk-header moving forward, but when we print the conflict out, we
detect those hunk headers, and do the above.
If the final hunk doesn't actually contain any differences, don't
bother printing it.
Signed-off-by: NeilBrown <neil@brown.name>