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
This commit is contained in:
Junio C Hamano
2023-01-23 13:39:51 -08:00
4 changed files with 24 additions and 0 deletions

View File

@ -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);
}