diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-01-24 00:39:51 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-01-24 00:39:51 +0300 |
commit | 5427bb4893e29a9502bbee5aed84c3b26e1a4e15 (patch) | |
tree | 9e8a02d927e20bc6259919e42f338d82cbca689d /compat | |
parent | cd37c45acf8170aa80a4d7bd44ea5fc8241047f2 (diff) | |
parent | 54463d32ef6798c772c8bbf69b2c1897a854db9f (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.c | 9 |
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); +} |