summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2022-02-17 21:14:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-02-17 22:56:56 (GMT)
commit97169fc361fd3ab2eedbfedd6c13806433be4036 (patch)
treee71b93126728ba7c4795b25c8d6c708a136b4279 /grep.c
parentc1760352e0b27cfbdffd97dec50a9eb552318993 (diff)
downloadgit-97169fc361fd3ab2eedbfedd6c13806433be4036.zip
git-97169fc361fd3ab2eedbfedd6c13806433be4036.tar.gz
git-97169fc361fd3ab2eedbfedd6c13806433be4036.tar.bz2
grep: fix triggering PCRE2_NO_START_OPTIMIZE workaround
PCRE2 bug 2642 was fixed in version 10.36. Our 95ca1f987e (grep/pcre2: better support invalid UTF-8 haystacks, 2021-01-24) worked around it on older versions by setting the flag PCRE2_NO_START_OPTIMIZE. 797c359978 (grep/pcre2: use compile-time PCREv2 version test, 2021-02-18) switched it around to set the flag on 10.36 and higher instead, while it claimed to use "the same test done at compile-time". Switch the condition back to apply the workaround on PCRE2 versions _before_ 10.36. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/grep.c b/grep.c
index 636ac48..29deb85 100644
--- a/grep.c
+++ b/grep.c
@@ -386,7 +386,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
!(!opt->ignore_case && (p->fixed || p->is_fixed)))
options |= (PCRE2_UTF | PCRE2_MATCH_INVALID_UTF);
-#ifdef GIT_PCRE2_VERSION_10_36_OR_HIGHER
+#ifndef GIT_PCRE2_VERSION_10_36_OR_HIGHER
/* Work around https://bugs.exim.org/show_bug.cgi?id=2642 fixed in 10.36 */
if (PCRE2_MATCH_INVALID_UTF && options & (PCRE2_UTF | PCRE2_CASELESS))
options |= PCRE2_NO_START_OPTIMIZE;