summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-11-23 14:48:00 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-11-23 14:48:00 -0800
commita650ff5aecf4be98c78ccfcae388a8d4029a46cf (patch)
treeb693f90020964c5bd2915361af298dbd9bdfcb55 /grep.c
parentGit 2.34 (diff)
parentRevert "grep/pcre2: fix an edge case concerning ascii patterns and UTF-8 data" (diff)
downloadtgif-a650ff5aecf4be98c78ccfcae388a8d4029a46cf.tar.xz
Merge branch 'hm/paint-hits-in-log-grep' into maint
"git grep" looking in a blob that has non-UTF8 payload was completely broken when linked with versions of PCREv2 library older than 10.34 in the latest release. * hm/paint-hits-in-log-grep: Revert "grep/pcre2: fix an edge case concerning ascii patterns and UTF-8 data"
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/grep.c b/grep.c
index f6e113e9f0..fe847a0111 100644
--- a/grep.c
+++ b/grep.c
@@ -382,10 +382,8 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
}
options |= PCRE2_CASELESS;
}
- if ((!opt->ignore_locale && !has_non_ascii(p->pattern)) ||
- (!opt->ignore_locale && is_utf8_locale() &&
- has_non_ascii(p->pattern) && !(!opt->ignore_case &&
- (p->fixed || p->is_fixed))))
+ if (!opt->ignore_locale && is_utf8_locale() && has_non_ascii(p->pattern) &&
+ !(!opt->ignore_case && (p->fixed || p->is_fixed)))
options |= (PCRE2_UTF | PCRE2_MATCH_INVALID_UTF);
#ifdef GIT_PCRE2_VERSION_10_36_OR_HIGHER