summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-05-20 18:59:09 -0700
committerJunio C Hamano <gitster@pobox.com>2009-05-20 18:59:09 -0700
commit065b0702f748b50e69d67609ace2632ce04b79a1 (patch)
tree6a78474d618eb083713429dc064c1c8e07e6382c /grep.c
parentd00e364de99d51bb76e437820e23cfa820417ec5 (diff)
parente701fadb9e0e51a6811690d95a53bd1f5b6fad86 (diff)
downloadgit-065b0702f748b50e69d67609ace2632ce04b79a1.tar.gz
Merge branch 'maint'
* maint: grep: fix word-regexp colouring completion: use git rev-parse to detect bare repos Cope better with a _lot_ of packs for-each-ref: fix segfault in copy_email
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/grep.c b/grep.c
index 04c777a20c..a649f063cf 100644
--- a/grep.c
+++ b/grep.c
@@ -305,6 +305,7 @@ static int match_one_pattern(struct grep_pat *p, char *bol, char *eol,
{
int hit = 0;
int saved_ch = 0;
+ const char *start = bol;
if ((p->token != GREP_PATTERN) &&
((p->token == GREP_PATTERN_HEAD) != (ctx == GREP_CONTEXT_HEAD)))
@@ -365,6 +366,10 @@ static int match_one_pattern(struct grep_pat *p, char *bol, char *eol,
}
if (p->token == GREP_PATTERN_HEAD && saved_ch)
*eol = saved_ch;
+ if (hit) {
+ pmatch[0].rm_so += bol - start;
+ pmatch[0].rm_eo += bol - start;
+ }
return hit;
}