#include "xdiff-interface.h"
#include "diff.h"
#include "diffcore.h"
+#include "commit.h"
static int grep_source_load(struct grep_source *gs);
static int grep_source_is_binary(struct grep_source *gs);
static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
{
+ int icase, ascii_only;
int err;
p->word_regexp = opt->word_regexp;
p->ignore_case = opt->ignore_case;
+ icase = opt->regflags & REG_ICASE || p->ignore_case;
+ ascii_only = !has_non_ascii(p->pattern);
if (opt->fixed)
p->fixed = 1;
- else if (is_fixed(p->pattern, p->patternlen))
+ else if ((!icase || ascii_only) &&
+ is_fixed(p->pattern, p->patternlen))
p->fixed = 1;
else
p->fixed = 0;