summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2009-06-03 22:51:56 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-06-03 22:51:56 -0700
commit9831b370b5e50b81faf47d858cd8c6e9e2200204 (patch)
tree015195b83ceaa5c681684f4bc6ede43c8c4f09d8 /grep.c
parentShow presence of stashed changes in bash prompt. (diff)
parentGIT 1.6.3.2 (diff)
downloadtgif-9831b370b5e50b81faf47d858cd8c6e9e2200204.tar.xz
Merge branch 'maint' to sync with 1.6.3.2
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/grep.c b/grep.c
index 7bf4a60ac7..92a47c71e7 100644
--- a/grep.c
+++ b/grep.c
@@ -331,7 +331,7 @@ static int match_one_pattern(struct grep_pat *p, char *bol, char *eol,
if (hit && p->word_regexp) {
if ((pmatch[0].rm_so < 0) ||
- (eol - bol) <= pmatch[0].rm_so ||
+ (eol - bol) < pmatch[0].rm_so ||
(pmatch[0].rm_eo < 0) ||
(eol - bol) < pmatch[0].rm_eo)
die("regexp returned nonsense");
@@ -350,6 +350,10 @@ static int match_one_pattern(struct grep_pat *p, char *bol, char *eol,
else
hit = 0;
+ /* Words consist of at least one character. */
+ if (pmatch->rm_so == pmatch->rm_eo)
+ hit = 0;
+
if (!hit && pmatch[0].rm_so + bol + 1 < eol) {
/* There could be more than one match on the
* line, and the first match might not be