Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-01-24 00:39:51 +0300
committerJunio C Hamano <gitster@pobox.com>2023-01-24 00:39:51 +0300
commit5427bb4893e29a9502bbee5aed84c3b26e1a4e15 (patch)
tree9e8a02d927e20bc6259919e42f338d82cbca689d /compat
parentcd37c45acf8170aa80a4d7bd44ea5fc8241047f2 (diff)
parent54463d32ef6798c772c8bbf69b2c1897a854db9f (diff)
Merge branch 'rs/use-enhanced-bre-on-macos'
Newer regex library macOS stopped enabling GNU-like enhanced BRE, where '\(A\|B\)' works as alternation, unless explicitly asked with the REG_ENHANCED flag. "git grep" now can be compiled to do so, to retain the old behaviour. * rs/use-enhanced-bre-on-macos: use enhanced basic regular expressions on macOS
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 0000000000..84193ce53b
--- /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);
+}