From 0db3a999746fa190868b4feed38d1f69cdb284f3 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 13 Nov 2012 11:16:09 +1100 Subject: [PATCH] vpatch: fix check_line to stop at hunk headers. 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 --- vpatch.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vpatch.c b/vpatch.c index 48edb33..6274475 100644 --- 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; -- 2.39.5