@matheusbsbs / matheus-bagliano / commits / 3632cfc248
Fork 0

Use compatibility regex library for OSX/Darwin

The standard libc regex library on OSX does not support alternation in POSIX Basic Regular Expression mode. This breaks the diff.funcname functionality on OSX. To fix this, we use the GNU regex library which is already present in the compat/ diretory for the MinGW port. However, simply adding compat/ to the COMPAT_CFLAGS variable causes a conflict between the system fnmatch.h and the one present in compat/. To remedy this, move the regex and fnmatch functionality to their own subdirectories in compat/ so they can be included seperately. Signed-off-by: Arjen Laarhoven <arjen@yaph.org> Tested-by: Mike Ralphson <mike@abacus.co.uk> (AIX) Tested-by: Johannes Sixt <johannes.sixt@telecom.at> (MinGW) Signed-off-by: Junio C Hamano <gitster@pobox.com>

Arjen Laarhoven committed Sep 7, 2008 at 20:45 UTC 3632cfc2487afc41c7c9e939a9d357daca3e5d67
6 files changed +10 -2
Makefile
+4 -2
@@ -626,6 +626,8 @@ ifeq ($(uname_S),Darwin)
626 endif
627 NO_STRLCPY = YesPlease
628 NO_MEMMEM = YesPlease
629 + COMPAT_CFLAGS += -Icompat/regex
630 + COMPAT_OBJS += compat/regex/regex.o
631 endif
632 ifeq ($(uname_S),SunOS)
633 NEEDS_SOCKET = YesPlease
@@ -750,10 +752,10 @@ ifneq (,$(findstring MINGW,$(uname_S)))
752 NO_SVN_TESTS = YesPlease
753 NO_PERL_MAKEMAKER = YesPlease
754 NO_POSIX_ONLY_PROGRAMS = YesPlease
753 - COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat
755 + COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
756 COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1
757 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
756 - COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o compat/winansi.o
758 + COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o
759 EXTLIBS += -lws2_32
760 X = .exe
761 gitexecdir = ../libexec/git-core
compat/fnmatch/fnmatch.c renamed
compat/fnmatch/fnmatch.h renamed
compat/regex/regex.c renamed
compat/regex/regex.h renamed
t/t4018-diff-funcname.sh
+6
@@ -57,4 +57,10 @@ test_expect_success 'last regexp must not be negated' '
57 test_must_fail git diff --no-index Beer.java Beer-correct.java
58 '
59
60 +test_expect_success 'alternation in pattern' '
61 + git config diff.java.funcname "^[ ]*\\(\\(public\\|static\\).*\\)$"
62 + git diff --no-index Beer.java Beer-correct.java |
63 + grep "^@@.*@@ public static void main("
64 +'
65 +
66 test_done