summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2023-01-08 00:42:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2023-01-08 01:06:34 (GMT)
commit54463d32ef6798c772c8bbf69b2c1897a854db9f (patch)
tree0d731d9274083009674ac43a2b2963b8bda4297b /compat
parentc48035d29b4e524aed3a32f0403676f0d9128863 (diff)
downloadgit-54463d32ef6798c772c8bbf69b2c1897a854db9f.zip
git-54463d32ef6798c772c8bbf69b2c1897a854db9f.tar.gz
git-54463d32ef6798c772c8bbf69b2c1897a854db9f.tar.bz2
use enhanced basic regular expressions on macOS
When 1819ad327b (grep: fix multibyte regex handling under macOS, 2022-08-26) started to use the native regex library instead of Git's own (compat/regex/), it lost support for alternation in basic regular expressions. Bring it back by enabling the flag REG_ENHANCED on macOS when compiling basic regular expressions. Reported-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> Suggested-by: Jeff King <peff@peff.net> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/regcomp_enhanced.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/compat/regcomp_enhanced.c b/compat/regcomp_enhanced.c
new file mode 100644
index 0000000..84193ce
--- /dev/null
+++ b/compat/regcomp_enhanced.c
@@ -0,0 +1,9 @@
+#include "../git-compat-util.h"
+#undef regcomp
+
+int git_regcomp(regex_t *preg, const char *pattern, int cflags)
+{
+ if (!(cflags & REG_EXTENDED))
+ cflags |= REG_ENHANCED;
+ return regcomp(preg, pattern, cflags);
+}