diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-06-03 22:51:56 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-06-03 22:51:56 -0700 |
commit | 9831b370b5e50b81faf47d858cd8c6e9e2200204 (patch) | |
tree | 015195b83ceaa5c681684f4bc6ede43c8c4f09d8 /grep.c | |
parent | Show presence of stashed changes in bash prompt. (diff) | |
parent | GIT 1.6.3.2 (diff) | |
download | tgif-9831b370b5e50b81faf47d858cd8c6e9e2200204.tar.xz |
Merge branch 'maint' to sync with 1.6.3.2
Diffstat (limited to 'grep.c')
-rw-r--r-- | grep.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |