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>
Junio C Hamano committed
Sep 27, 2006 at 16:42 UTC
a3f5d02edb2c1a037ed3ed8d2ebd3f3e5da9d198
1 file changed
+2
-5
grep.c
+2
-5
@@ -138,16 +138,13 @@ void compile_grep_patterns(struct grep_opt *opt)
138
{
139
struct grep_pat *p;
140
141
- if (opt->fixed)
142
- return;
143
-
144
- /* First compile regexps */
141
for (p = opt->pattern_list; p; p = p->next) {
142
switch (p->token) {
143
case GREP_PATTERN: /* atom */
144
case GREP_PATTERN_HEAD:
145
case GREP_PATTERN_BODY:
150
- compile_regexp(p, opt);
146
+ if (!opt->fixed)
147
+ compile_regexp(p, opt);
148
break;
149
default:
150
opt->extended = 1;