Subject: [PATCH] regex: not all macOS platforms seem to have REG_ENHANCED

From: Junio C Hamano <[email-masked]>
Date: Thu, 19 Mar 2026 15:37:54 -0700

Earlier, 54463d32 (use enhanced basic regular expressions on macOS,
2023-01-08) started to use the REG_ENHANCED option when ERE is not
in use on macOS.  The build seems to have started failing on
macos-14 CI jobs at GitHub, however, as apparently not all the macOS
platforms have this flag defined.

Signed-off-by: Junio C Hamano <[email-masked]>
---
 compat/regcomp_enhanced.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compat/regcomp_enhanced.c b/compat/regcomp_enhanced.c
index 84193ce53b..51e1358170 100644
--- a/compat/regcomp_enhanced.c
+++ b/compat/regcomp_enhanced.c
@@ -3,7 +3,9 @@
 
 int git_regcomp(regex_t *preg, const char *pattern, int cflags)
 {
+#ifdef REG_ENHANCED
 	if (!(cflags & REG_EXTENDED))
 		cflags |= REG_ENHANCED;
+#endif
 	return regcomp(preg, pattern, cflags);
 }
-- 
2.53.0-816-g44373249a2