Browse Source

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>
maint
Junio C Hamano 19 years ago
parent
commit
a3f5d02edb
  1. 5
      grep.c

5
grep.c

@ -138,15 +138,12 @@ void compile_grep_patterns(struct grep_opt *opt) @@ -138,15 +138,12 @@ 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:
if (!opt->fixed)
compile_regexp(p, opt);
break;
default:

Loading…
Cancel
Save