From: Junio C Hamano Date: Thu, 21 Feb 2008 00:13:19 +0000 (-0800) Subject: Merge branch 'bc/fopen' X-Git-Tag: v1.5.5-rc0~183 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/c0284cea3149cb20e24ee5e25b475e5f8edba84f?hp=-c Merge branch 'bc/fopen' * bc/fopen: Add compat/fopen.c which returns NULL on attempt to open directory --- c0284cea3149cb20e24ee5e25b475e5f8edba84f diff --combined Makefile index 83c359acde,debfc236d2..d33a556ffe --- a/Makefile +++ b/Makefile @@@ -3,6 -3,9 +3,9 @@@ all: # Define V=1 to have a more verbose compile. # + # Define FREAD_READS_DIRECTORIES if your are on a system which succeeds + # when attempting to read from an fopen'ed directory. + # # Define NO_OPENSSL environment variable if you do not have OpenSSL. # This also implies MOZILLA_SHA1. # @@@ -137,10 -140,6 +140,10 @@@ # Define THREADED_DELTA_SEARCH if you have pthreads and wish to exploit # parallel delta searching when packing objects. # +# Define INTERNAL_QSORT to use Git's implementation of qsort(), which +# is a simplified version of the merge sort used in glibc. This is +# recommended if Git triggers O(n^2) behavior in your platform's qsort(). +# GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @$(SHELL_PATH) ./GIT-VERSION-GEN @@@ -235,7 -234,7 +238,7 @@@ SCRIPT_SH = git-lost-found.sh git-quiltimport.sh git-submodule.sh \ git-filter-branch.sh \ git-stash.sh \ - git-help--browse.sh + git-web--browse.sh SCRIPT_PERL = \ git-add--interactive.perl \ @@@ -622,6 -621,10 +625,10 @@@ endi ifdef NO_C99_FORMAT BASIC_CFLAGS += -DNO_C99_FORMAT endif + ifdef FREAD_READS_DIRECTORIES + COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES + COMPAT_OBJS += compat/fopen.o + endif ifdef NO_SYMLINK_HEAD BASIC_CFLAGS += -DNO_SYMLINK_HEAD endif @@@ -726,10 -729,6 +733,10 @@@ ifdef NO_MEMME COMPAT_CFLAGS += -DNO_MEMMEM COMPAT_OBJS += compat/memmem.o endif +ifdef INTERNAL_QSORT + COMPAT_CFLAGS += -DINTERNAL_QSORT + COMPAT_OBJS += compat/qsort.o +endif ifdef THREADED_DELTA_SEARCH BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH @@@ -827,7 -826,6 +834,7 @@@ git$X: git.o $(BUILTIN_OBJS) $(GITLIBS help.o: help.c common-cmds.h GIT-CFLAGS $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \ + '-DGIT_HTML_PATH="$(htmldir_SQ)"' \ '-DGIT_MAN_PATH="$(mandir_SQ)"' \ '-DGIT_INFO_PATH="$(infodir_SQ)"' $< @@@ -848,6 -846,7 +855,6 @@@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : % -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ - -e 's|@@HTMLDIR@@|$(htmldir_SQ)|g' \ $@.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@ diff --combined git-compat-util.h index 05146047e0,46d5e93c72..2a40703c85 --- a/git-compat-util.h +++ b/git-compat-util.h @@@ -204,6 -204,11 +204,11 @@@ void *gitmemmem(const void *haystack, s const void *needle, size_t needlelen); #endif + #ifdef FREAD_READS_DIRECTORIES + #define fopen(a,b) git_fopen(a,b) + extern FILE *git_fopen(const char*, const char*); + #endif + #ifdef __GLIBC_PREREQ #if __GLIBC_PREREQ(2, 1) #define HAVE_STRCHRNUL @@@ -426,10 -431,4 +431,10 @@@ static inline int strtol_i(char const * return 0; } +#ifdef INTERNAL_QSORT +void git_qsort(void *base, size_t nmemb, size_t size, + int(*compar)(const void *, const void *)); +#define qsort git_qsort +#endif + #endif