]> git.neil.brown.name Git - wiggle.git/commitdiff
isolate_conflicts: don't look for eol that cannot be there.
authorNeil Brown <neilb@suse.de>
Thu, 10 May 2012 07:09:52 +0000 (17:09 +1000)
committerNeil Brown <neilb@suse.de>
Thu, 10 May 2012 07:09:52 +0000 (17:09 +1000)
When looking for 'wiggles' we need to track whole lines
in the original file.  But when looking for an end-of-line
we shouldn't look at an merge-item that doesn't even
exist in the original file.

Reported-by: Chris Peterson <cpeterso@cpeterso.com>
Signed-off-by: NeilBrown <neilb@suse.de>
merge2.c

index 565181e1795c56803c6baf13269d1dccd3aaf2ec..34080767022620da798f5696cb72fae78b51f94c 100644 (file)
--- a/merge2.c
+++ b/merge2.c
@@ -295,7 +295,7 @@ static int isolate_conflicts(struct file af, struct file bf, struct file cf,
                        }
                        i = j - 1;
                }
-               if (ends_line(af.list[m[i].a+m[i].al-1])) {
+               if (m[i].al > 0 && ends_line(af.list[m[i].a+m[i].al-1])) {
                        unmatched = 0;
                        changed = 0;
                }