When merging hunks, keep all FROM lines before corresponding TO lines. Fixes crash when merging common 1 -deleted 1 +inserted 1 deleted 2 common 2 and common 1 inserted 1 -deleted 2 +inserted 2 +inserted 3 common 2 These should merge to common 1 -deleted 1 -deleted 2 +inserted 1 +inserted 2 +inserted 3 common 2 but before this fix the result was common 1 -deleted 1 +inserted 1 -deleted 2 +inserted 2 +inserted 3 common 2 I can't help feeling there should be a cleaner fix, a way to generate the merged hunk in the right order to begin with.