aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjen Laarhoven <arjen@yaph.org>2008-09-07 20:45:37 +0200
committerJunio C Hamano <gitster@pobox.com>2008-09-10 13:36:40 -0700
commit3632cfc2487afc41c7c9e939a9d357daca3e5d67 (patch)
treea0e56de2ab6f56753406c47baf8ec8bd79e91cb5
parent971e628384fea14e9c0bf96e1c69b97df6ec540e (diff)
downloadgit-3632cfc2487afc41c7c9e939a9d357daca3e5d67.tar.gz
git-3632cfc2487afc41c7c9e939a9d357daca3e5d67.tar.xz
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>
-rw-r--r--Makefile6
-rw-r--r--compat/fnmatch/fnmatch.c (renamed from compat/fnmatch.c)0
-rw-r--r--compat/fnmatch/fnmatch.h (renamed from compat/fnmatch.h)0
-rw-r--r--compat/regex/regex.c (renamed from compat/regex.c)0
-rw-r--r--compat/regex/regex.h (renamed from compat/regex.h)0
-rwxr-xr-xt/t4018-diff-funcname.sh6
6 files changed, 10 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 672ea7423..a8b3f9e3c 100644
--- a/Makefile
+++ b/Makefile
@@ -626,6 +626,8 @@ ifeq ($(uname_S),Darwin)
endif
NO_STRLCPY = YesPlease
NO_MEMMEM = YesPlease
+ COMPAT_CFLAGS += -Icompat/regex
+ COMPAT_OBJS += compat/regex/regex.o
endif
ifeq ($(uname_S),SunOS)
NEEDS_SOCKET = YesPlease
@@ -750,10 +752,10 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_SVN_TESTS = YesPlease
NO_PERL_MAKEMAKER = YesPlease
NO_POSIX_ONLY_PROGRAMS = YesPlease
- COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat
+ COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
- COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o compat/winansi.o
+ COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o
EXTLIBS += -lws2_32
X = .exe
gitexecdir = ../libexec/git-core
diff --git a/compat/fnmatch.c b/compat/fnmatch/fnmatch.c
index 1f4ead5f9..1f4ead5f9 100644
--- a/compat/fnmatch.c
+++ b/compat/fnmatch/fnmatch.c
diff --git a/compat/fnmatch.h b/compat/fnmatch/fnmatch.h
index cc3ec3794..cc3ec3794 100644
--- a/compat/fnmatch.h
+++ b/compat/fnmatch/fnmatch.h
diff --git a/compat/regex.c b/compat/regex/regex.c
index 87b33e466..87b33e466 100644
--- a/compat/regex.c
+++ b/compat/regex/regex.c
diff --git a/compat/regex.h b/compat/regex/regex.h
index 6eb64f140..6eb64f140 100644
--- a/compat/regex.h
+++ b/compat/regex/regex.h
diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
index 833d6cbcf..18bcd9713 100755
--- a/t/t4018-diff-funcname.sh
+++ b/t/t4018-diff-funcname.sh
@@ -57,4 +57,10 @@ test_expect_success 'last regexp must not be negated' '
test_must_fail git diff --no-index Beer.java Beer-correct.java
'
+test_expect_success 'alternation in pattern' '
+ git config diff.java.funcname "^[ ]*\\(\\(public\\|static\\).*\\)$"
+ git diff --no-index Beer.java Beer-correct.java |
+ grep "^@@.*@@ public static void main("
+'
+
test_done