]> git.neil.brown.name Git - wiggle.git/commit
merge: be more careful about aligning hunk-headers with newlines.
authorNeilBrown <neilb@suse.de>
Fri, 22 Mar 2013 04:12:49 +0000 (15:12 +1100)
committerNeilBrown <neilb@suse.de>
Fri, 22 Mar 2013 04:12:49 +0000 (15:12 +1100)
commitf4f1d92c222559376f717a2611afe87181fa5274
tree55651e1bd46e47dde50af54e7447443d5d9e89dc
parentfaa36dd65bfccde8f61debeaa9a691b5185f5777
merge: be more careful about aligning hunk-headers with newlines.

When matching a diff to a file, it would be very confusing.
if the last match from one hunk were on the same line of the
original as the first match of the next hunk.
So we try to align hunk-headers with newlines.

In particular, we often find Unmatched and Extraneous
sections together.  There can be encoded in any order.
If the Extraneous section contains a hunk-header,
we want to make sure that if there is a newline anywhere
in the unmatched section, then the Unmatched that is placed
before the hunk-headers Extraneous ends on a newline.

There was code the attempted this, but it was too simplistic
and would sometimes move outside the regions that it should
have been examine, which would lead to various bugs.

The tests case which demonstrated this is added to the
test suite.

Reported-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: NeilBrown <neilb@suse.de>
merge2.c
tests/linux/iomap/merge [new file with mode: 0644]
tests/linux/iomap/orig [new file with mode: 0644]
tests/linux/iomap/patch [new file with mode: 0644]
tests/linux/raid1-A/merge