]> git.neil.brown.name Git - wiggle.git/commitdiff
vpatch: fix check_line to stop at hunk headers.
authorNeilBrown <neilb@suse.de>
Tue, 13 Nov 2012 00:16:09 +0000 (11:16 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 13 Nov 2012 00:16:09 +0000 (11:16 +1100)
check_line() includes invisible bits because they could in some sense
be part of 'this' line.  It ignore hunk headers, but it really should stop
at them, because nothing before could be related to this line.

This fixes a problem where 'N' and 'P' would find hunk headers
which isn't really helpful.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch.c

index 48edb336e53a55b2f7edd40780e6d15a8782a371..627447573db40615aff26102141c79b0bfa916ed 100644 (file)
--- a/vpatch.c
+++ b/vpatch.c
@@ -574,8 +574,12 @@ static int check_line(struct mpos pos, struct file fm, struct file fb,
                        if (mode & (BEFORE|AFTER))
                                rv |= CHANGES;
                } else if (m[pos.p.m].type == Extraneous) {
-                       /* hunk headers don't count as wiggles */
-                       if (fb.list[m[pos.p.m].b].start[0] != '\0')
+                       if (fb.list[m[pos.p.m].b].start[0] == '\0')
+                               /* hunk headers don't count as wiggles
+                                * and nothing before a hunk header
+                                * can possibly be part of this 'line' */
+                               break;
+                       else
                                rv |= WIGGLED;
                } else if (m[pos.p.m].type == Unmatched)
                        unmatched = 1;