summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-09-27 16:42:53 -0700
committerJunio C Hamano <junkio@cox.net>2006-09-27 16:42:53 -0700
commita3f5d02edb2c1a037ed3ed8d2ebd3f3e5da9d198 (patch)
tree00e134633cc8d37e0631bfe5ffe8f863bc0feffc /grep.c
parentb48fb5b6a950a6757b790e9160967065a3e03978 (diff)
downloadgit-a3f5d02edb2c1a037ed3ed8d2ebd3f3e5da9d198.tar.gz
grep: fix --fixed-strings combined with expression.
"git grep --fixed-strings -e GIT --and -e VERSION .gitignore" misbehaved because we did not notice this needs to grab lines that have the given two fixed strings at the same time. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/grep.c b/grep.c
index 2c740bde50..c411ddd4d5 100644
--- a/grep.c
+++ b/grep.c
@@ -138,16 +138,13 @@ void compile_grep_patterns(struct grep_opt *opt)
{
struct grep_pat *p;
- if (opt->fixed)
- return;
-
- /* First compile regexps */
for (p = opt->pattern_list; p; p = p->next) {
switch (p->token) {
case GREP_PATTERN: /* atom */
case GREP_PATTERN_HEAD:
case GREP_PATTERN_BODY:
- compile_regexp(p, opt);
+ if (!opt->fixed)
+ compile_regexp(p, opt);
break;
default:
opt->extended = 1;