summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2009-05-23 13:45:26 +0200
committerJunio C Hamano <gitster@pobox.com>2009-05-23 16:29:05 -0700
commitdbb6a4ada6c6c1065b62313127ff032196e9d232 (patch)
tree27c336e0e4c02aa1427379360e2d845ca727c72a /grep.c
parente701fadb9e0e51a6811690d95a53bd1f5b6fad86 (diff)
downloadgit-dbb6a4ada6c6c1065b62313127ff032196e9d232.tar.gz
grep: fix word-regexp at the beginning of lines
After bol is forwarded, it doesn't represent the beginning of the line any more. This means that the beginning-of-line marker (^) mustn't match, i.e. the regex flag REG_NOTBOL needs to be set. This bug was introduced by fb62eb7fab97cea880ea7fe4f341a4dfad14ab48 ("grep -w: forward to next possible position after rejected match"). Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/grep.c b/grep.c
index a649f063cf..cc6d5b04c1 100644
--- a/grep.c
+++ b/grep.c
@@ -360,6 +360,7 @@ static int match_one_pattern(struct grep_pat *p, char *bol, char *eol,
bol = pmatch[0].rm_so + bol + 1;
while (word_char(bol[-1]) && bol < eol)
bol++;
+ eflags |= REG_NOTBOL;
if (bol < eol)
goto again;
}