From: Junio C Hamano Date: Wed, 10 May 2006 01:27:56 +0000 (-0700) Subject: builtin-grep: -w fix X-Git-Tag: v1.4.1-rc1~118^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/02ab1c490dc4827446c851468eb01ecc23b6cc48?hp=c39c4f4746ba4543b532594543d252e2bad62234 builtin-grep: -w fix Signed-off-by: Junio C Hamano --- diff --git a/builtin-grep.c b/builtin-grep.c index d290074af2..52ac521afe 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -241,10 +241,10 @@ static int grep_buffer(struct grep_opt *opt, const char *name, die("regexp returned nonsense"); if (pmatch[0].rm_so != 0 && word_char(bol[pmatch[0].rm_so-1])) - continue; /* not a word boundary */ - if ((eol-bol) < pmatch[0].rm_eo && + hit = 0; + if (pmatch[0].rm_eo != (eol-bol) && word_char(bol[pmatch[0].rm_eo])) - continue; /* not a word boundary */ + hit = 0; } if (hit) break;