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>
This commit is contained in:
Junio C Hamano 2006-09-27 16:42:53 -07:00
parent b48fb5b6a9
commit a3f5d02edb

7
grep.c
View File

@ -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;