Merge branch 'jh/memihash-opt'
authorJunio C Hamano <gitster@pobox.com>
Thu, 20 Apr 2017 04:37:25 +0000 (21:37 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Apr 2017 04:37:25 +0000 (21:37 -0700)
Hotfix for a topic that is already in 'master'.

* jh/memihash-opt:
p0004: make perf test executable
t3008: skip lazy-init test on a single-core box
test-online-cpus: helper to return cpu count
name-hash: fix buffer overrun

1  2 
Makefile
t/helper/.gitignore
diff --combined Makefile
index c6dbeccf5e2aaed990d9f9bb2c95c74f252d346c,dc0c3689b11c92bacfeee61fc222d9ace0c222e0..eb1a1a7cffd5efc06ada671ca482eb638cd25d61
+++ b/Makefile
@@@ -102,6 -102,8 +102,6 @@@ all:
  #
  # Define MKDIR_WO_TRAILING_SLASH if your mkdir() can't deal with trailing slash.
  #
 -# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
 -#
  # Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
  # in the C library.
  #
  # Define PPC_SHA1 environment variable when running make to make use of
  # a bundled SHA1 routine optimized for PowerPC.
  #
 +# Define DC_SHA1 to unconditionally enable the collision-detecting sha1
 +# algorithm. This is slower, but may detect attempted collision attacks.
 +# Takes priority over other *_SHA1 knobs.
 +#
 +# Define OPENSSL_SHA1 environment variable when running make to link
 +# with the SHA1 routine from openssl library.
 +#
  # Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
  # in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
  # wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
  # apostrophes to be ASCII so that cut&pasting examples to the shell
  # will work.
  #
 +# Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
 +# documentation.
 +#
 +# Define ASCIIDOCTOR_EXTENSIONS_LAB to point to the location of the Asciidoctor
 +# Extensions Lab if you have it available.
 +#
  # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
  #
  # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
  # 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().
  #
 +# Define HAVE_ISO_QSORT_S if your platform provides a qsort_s() that's
 +# compatible with the one described in C11 Annex K.
 +#
  # Define UNRELIABLE_FSTAT if your system's fstat does not return the same
  # information on a not yet closed file that lstat would return for the same
  # file after it was closed.
  #
  # Define NATIVE_CRLF if your platform uses CRLF for line endings.
  #
 -# Define XDL_FAST_HASH to use an alternative line-hashing method in
 -# the diff algorithm.  It gives a nice speedup if your processor has
 -# fast unaligned word loads.  Does NOT work on big-endian systems!
 -# Enabled by default on x86_64.
 -#
  # Define GIT_USER_AGENT if you want to change how git identifies itself during
  # network interactions.  The default is "git/$(GIT_VERSION)".
  #
@@@ -536,10 -527,12 +536,10 @@@ SCRIPT_LIB += git-sh-setu
  SCRIPT_LIB += git-sh-i18n
  
  SCRIPT_PERL += git-add--interactive.perl
 -SCRIPT_PERL += git-difftool.perl
  SCRIPT_PERL += git-archimport.perl
  SCRIPT_PERL += git-cvsexportcommit.perl
  SCRIPT_PERL += git-cvsimport.perl
  SCRIPT_PERL += git-cvsserver.perl
 -SCRIPT_PERL += git-relink.perl
  SCRIPT_PERL += git-send-email.perl
  SCRIPT_PERL += git-svn.perl
  
@@@ -626,11 -619,11 +626,12 @@@ TEST_PROGRAMS_NEED_X += test-line-buffe
  TEST_PROGRAMS_NEED_X += test-match-trees
  TEST_PROGRAMS_NEED_X += test-mergesort
  TEST_PROGRAMS_NEED_X += test-mktemp
+ TEST_PROGRAMS_NEED_X += test-online-cpus
  TEST_PROGRAMS_NEED_X += test-parse-options
  TEST_PROGRAMS_NEED_X += test-path-utils
  TEST_PROGRAMS_NEED_X += test-prio-queue
  TEST_PROGRAMS_NEED_X += test-read-cache
 +TEST_PROGRAMS_NEED_X += test-ref-store
  TEST_PROGRAMS_NEED_X += test-regex
  TEST_PROGRAMS_NEED_X += test-revision-walking
  TEST_PROGRAMS_NEED_X += test-run-command
@@@ -788,7 -781,6 +789,7 @@@ LIB_OBJS += notes-cache.
  LIB_OBJS += notes-merge.o
  LIB_OBJS += notes-utils.o
  LIB_OBJS += object.o
 +LIB_OBJS += oidset.o
  LIB_OBJS += pack-bitmap.o
  LIB_OBJS += pack-bitmap-write.o
  LIB_OBJS += pack-check.o
@@@ -898,7 -890,6 +899,7 @@@ BUILTIN_OBJS += builtin/diff-files.
  BUILTIN_OBJS += builtin/diff-index.o
  BUILTIN_OBJS += builtin/diff-tree.o
  BUILTIN_OBJS += builtin/diff.o
 +BUILTIN_OBJS += builtin/difftool.o
  BUILTIN_OBJS += builtin/fast-export.o
  BUILTIN_OBJS += builtin/fetch-pack.o
  BUILTIN_OBJS += builtin/fetch.o
@@@ -940,7 -931,6 +941,7 @@@ BUILTIN_OBJS += builtin/prune.
  BUILTIN_OBJS += builtin/pull.o
  BUILTIN_OBJS += builtin/push.o
  BUILTIN_OBJS += builtin/read-tree.o
 +BUILTIN_OBJS += builtin/rebase--helper.o
  BUILTIN_OBJS += builtin/receive-pack.o
  BUILTIN_OBJS += builtin/reflog.o
  BUILTIN_OBJS += builtin/remote.o
@@@ -1289,6 -1279,9 +1290,6 @@@ ifdef MKDIR_WO_TRAILING_SLAS
        COMPAT_CFLAGS += -DMKDIR_WO_TRAILING_SLASH
        COMPAT_OBJS += compat/mkdir.o
  endif
 -ifdef NO_MKSTEMPS
 -      COMPAT_CFLAGS += -DNO_MKSTEMPS
 -endif
  ifdef NO_UNSETENV
        COMPAT_CFLAGS += -DNO_UNSETENV
        COMPAT_OBJS += compat/unsetenv.o
@@@ -1392,27 -1385,20 +1393,27 @@@ ifdef APPLE_COMMON_CRYPT
        SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
  endif
  
 +ifdef OPENSSL_SHA1
 +      EXTLIBS += $(LIB_4_CRYPTO)
 +      BASIC_CFLAGS += -DSHA1_OPENSSL
 +else
  ifdef BLK_SHA1
 -      SHA1_HEADER = "block-sha1/sha1.h"
        LIB_OBJS += block-sha1/sha1.o
 +      BASIC_CFLAGS += -DSHA1_BLK
  else
  ifdef PPC_SHA1
 -      SHA1_HEADER = "ppc/sha1.h"
        LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
 +      BASIC_CFLAGS += -DSHA1_PPC
  else
  ifdef APPLE_COMMON_CRYPTO
        COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
 -      SHA1_HEADER = <CommonCrypto/CommonDigest.h>
 +      BASIC_CFLAGS += -DSHA1_APPLE
  else
 -      SHA1_HEADER = <openssl/sha.h>
 -      EXTLIBS += $(LIB_4_CRYPTO)
 +      DC_SHA1 := YesPlease
 +      LIB_OBJS += sha1dc/sha1.o
 +      LIB_OBJS += sha1dc/ubc_check.o
 +      BASIC_CFLAGS += -DSHA1_DC
 +endif
  endif
  endif
  endif
@@@ -1439,11 -1425,6 +1440,11 @@@ ifdef INTERNAL_QSOR
        COMPAT_CFLAGS += -DINTERNAL_QSORT
        COMPAT_OBJS += compat/qsort.o
  endif
 +ifdef HAVE_ISO_QSORT_S
 +      COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
 +else
 +      COMPAT_OBJS += compat/qsort_s.o
 +endif
  ifdef RUNTIME_PREFIX
        COMPAT_CFLAGS += -DRUNTIME_PREFIX
  endif
@@@ -1506,6 -1487,10 +1507,6 @@@ ifndef NO_MSGFMT_EXTENDED_OPTION
        MSGFMT += --check --statistics
  endif
  
 -ifneq (,$(XDL_FAST_HASH))
 -      BASIC_CFLAGS += -DXDL_FAST_HASH
 -endif
 -
  ifdef GMTIME_UNRELIABLE_ERRORS
        COMPAT_OBJS += compat/gmtime.o
        BASIC_CFLAGS += -DGMTIME_UNRELIABLE_ERRORS
@@@ -1604,6 -1589,7 +1605,6 @@@ endi
  
  # Shell quote (do not use $(call) to accommodate ancient setups);
  
 -SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
  ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
  ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
  
@@@ -1636,7 -1622,8 +1637,7 @@@ PERLLIB_EXTRA_SQ = $(subst ','\'',$(PER
  # from the dependency list, that would make each entry appear twice.
  LIBS = $(filter-out %.o, $(GITLIBS)) $(EXTLIBS)
  
 -BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
 -      $(COMPAT_CFLAGS)
 +BASIC_CFLAGS += $(COMPAT_CFLAGS)
  LIB_OBJS += $(COMPAT_OBJS)
  
  # Quote for C
@@@ -1840,7 -1827,7 +1841,7 @@@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEF
  git.res: git.rc GIT-VERSION-FILE
        $(QUIET_RC)$(RC) \
          $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., ,$(GIT_VERSION))))) \
 -        -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" $< -o $@
 +        -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
  
  # This makes sure we depend on the NO_PERL setting itself.
  $(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
@@@ -1852,7 -1839,6 +1853,7 @@@ perl/perl.mak: perl/PM.stam
  
  perl/PM.stamp: FORCE
        @$(FIND) perl -type f -name '*.pm' | sort >$@+ && \
 +      $(PERL_PATH) -V >>$@+ && \
        { cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \
        $(RM) $@+
  
@@@ -2071,7 -2057,7 +2072,7 @@@ git-%$X: %.o GIT-LDFLAGS $(GITLIBS
  
  git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 -              $(LIBS) $(IMAP_SEND_LDFLAGS)
 +              $(IMAP_SEND_LDFLAGS) $(LIBS)
  
  git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
@@@ -2130,8 -2116,7 +2131,8 @@@ XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --
        --keyword=_ --keyword=N_ --keyword="Q_:1,2"
  XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
        --keyword=gettextln --keyword=eval_gettextln
 -XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
 +XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
 +      --keyword=__ --keyword=N__ --keyword="__n:1,2"
  LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
  LOCALIZED_SH = $(SCRIPT_SH)
  LOCALIZED_SH += git-parse-remote.sh
@@@ -2240,7 -2225,6 +2241,7 @@@ GIT-BUILD-OPTIONS: FORC
        @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
        @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
        @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
 +      @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
  ifdef TEST_OUTPUT_DIRECTORY
        @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
  endif
@@@ -2267,9 -2251,6 +2268,9 @@@ endi
  ifdef GIT_PERF_MAKE_OPTS
        @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
  endif
 +ifdef GIT_INTEROP_MAKE_OPTS
 +      @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
 +endif
  ifdef TEST_GIT_INDEX_VERSION
        @echo TEST_GIT_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(TEST_GIT_INDEX_VERSION)))'\' >>$@+
  endif
@@@ -2350,17 -2331,9 +2351,17 @@@ check: common-cmds.
  C_SOURCES = $(patsubst %.o,%.c,$(C_OBJ))
  %.cocci.patch: %.cocci $(C_SOURCES)
        @echo '    ' SPATCH $<; \
 +      ret=0; \
        for f in $(C_SOURCES); do \
 -              $(SPATCH) --sp-file $< $$f $(SPATCH_FLAGS); \
 -      done >$@ 2>$@.log; \
 +              $(SPATCH) --sp-file $< $$f $(SPATCH_FLAGS) || \
 +                      { ret=$$?; break; }; \
 +      done >$@+ 2>$@.log; \
 +      if test $$ret != 0; \
 +      then \
 +              cat $@.log; \
 +              exit 1; \
 +      fi; \
 +      mv $@+ $@; \
        if test -s $@; \
        then \
                echo '    ' SPATCH result: $@; \
diff --combined t/helper/.gitignore
index d1fa751cf9e0a472ab00cc84435a09e79fd0053c,b05d67c237f75d277bb695e3ce2422b9c8c12f05..acd5db180f31f5b81877c75f8a695c3e4437e34d
  /test-match-trees
  /test-mergesort
  /test-mktemp
+ /test-online-cpus
  /test-parse-options
  /test-path-utils
  /test-prio-queue
  /test-read-cache
 +/test-ref-store
  /test-regex
  /test-revision-walking
  /test-run-command