If we are close to the end-of-file, then don't expect
too many unchanged lines.
And allow zero lines of context in the merge if it is unchanged out
side the merge.
Update various tests to match - all clear improvements.
Signed-off-by: NeilBrown <neilb@suse.de>
int firstk = -1;
for (k = 0 ; k < m[j].al ; k++)
if (ends_line(af.list[m[j].a+k])) {
- if (firstk <= 0)
+ if (firstk < 0)
firstk = k;
newlines++;
if (newlines >= 3) {
break;
}
}
+ if (newlines < 3 &&
+ m[j+1].type == End)
+ /* Hit end of file, pretend we found 3 newlines. */
+ k = firstk;
+
if (firstk >= 0 &&
m[j+1].type == Unmatched) {
/* If this Unmatched exceeds 3 lines, just stop here */
bh->b_size = sh->size;
bh->b_list = BUF_LOCKED;
return bh;
-}
|||||||
bh->b_size = sh->size;
return bh;
-}
=======
dev->sector = compute_blocknr(sh, i);
-}
>>>>>>>
+}
8
9
0
-yes
|||||||
a
b
h
i
j
-yes
=======
A
B
H
I
J
-yes
>>>>>>>
+yes
with the word
<<<<<<<
two which is
-misspelt
|||||||
to which is
-misspelt
=======
too which is
-misspelt
>>>>>>>
+misspelt
with the word
<<<<<<<
two which is
-misspelt
|||||||
to which is
-misspelt
=======
too which was
-misspelt
>>>>>>>
+misspelt
the
<<<<<<<
file.
-
|||||||
file
-
=======
file that has changed
-
>>>>>>>
+
<<<<<<<
This is one line of the file
-
|||||||
This is 1 line of the file
-
=======
This is 1 line of the document
-
&&&&&&&
This is one line of the document
-
>>>>>>>
+
I think this is another line
So is this