Merge branch 'ti/external-sha1dc'
authorJunio C Hamano <gitster@pobox.com>
Tue, 19 Sep 2017 01:47:50 +0000 (10:47 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Sep 2017 01:47:50 +0000 (10:47 +0900)
Platforms that ship with a separate sha1 with collision detection
library can link to it instead of using the copy we ship as part of
our source tree.

* ti/external-sha1dc:
sha1dc: allow building with the external sha1dc library
sha1dc: build git plumbing code more explicitly

1  2 
Makefile
diff --combined Makefile
index f2bb7f2f63e458af6261b4a151d87ef9e973222e,9f492b5d1d37fa3621d45ab7292dd1b3a28b0b63..68948dfbf3f29531d41be591daa9a8ba8df72708
+++ b/Makefile
@@@ -162,6 -162,11 +162,11 @@@ all:
  # algorithm. This is slower, but may detect attempted collision attacks.
  # Takes priority over other *_SHA1 knobs.
  #
+ # Define DC_SHA1_EXTERNAL in addition to DC_SHA1 if you want to build / link
+ # git with the external SHA1 collision-detect library.
+ # Without this option, i.e. the default behavior is to build git with its
+ # own built-in code (or submodule).
+ #
  # Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the
  # sha1collisiondetection shipped as a submodule instead of the
  # non-submodule copy in sha1dc/. This is an experimental option used
@@@ -655,7 -660,6 +660,7 @@@ TEST_PROGRAMS_NEED_X += test-parse-opti
  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-write-cache
  TEST_PROGRAMS_NEED_X += test-ref-store
  TEST_PROGRAMS_NEED_X += test-regex
  TEST_PROGRAMS_NEED_X += test-revision-walking
@@@ -817,7 -821,6 +822,7 @@@ LIB_OBJS += notes-merge.
  LIB_OBJS += notes-utils.o
  LIB_OBJS += object.o
  LIB_OBJS += oidset.o
 +LIB_OBJS += packfile.o
  LIB_OBJS += pack-bitmap.o
  LIB_OBJS += pack-bitmap-write.o
  LIB_OBJS += pack-check.o
@@@ -844,7 -847,6 +849,7 @@@ LIB_OBJS += reflog-walk.
  LIB_OBJS += refs.o
  LIB_OBJS += refs/files-backend.o
  LIB_OBJS += refs/iterator.o
 +LIB_OBJS += refs/packed-backend.o
  LIB_OBJS += refs/ref-cache.o
  LIB_OBJS += ref-filter.o
  LIB_OBJS += remote.o
@@@ -1475,6 -1477,15 +1480,15 @@@ ifdef APPLE_COMMON_CRYPT
        BASIC_CFLAGS += -DSHA1_APPLE
  else
        DC_SHA1 := YesPlease
+       BASIC_CFLAGS += -DSHA1_DC
+       LIB_OBJS += sha1dc_git.o
+ ifdef DC_SHA1_EXTERNAL
+       ifdef DC_SHA1_SUBMODULE
+ $(error Only set DC_SHA1_EXTERNAL or DC_SHA1_SUBMODULE, not both)
+       endif
+       BASIC_CFLAGS += -DDC_SHA1_EXTERNAL
+       EXTLIBS += -lsha1detectcoll
+ else
  ifdef DC_SHA1_SUBMODULE
        LIB_OBJS += sha1collisiondetection/lib/sha1.o
        LIB_OBJS += sha1collisiondetection/lib/ubc_check.o
        LIB_OBJS += sha1dc/ubc_check.o
  endif
        BASIC_CFLAGS += \
-               -DSHA1_DC \
                -DSHA1DC_NO_STANDARD_INCLUDES \
                -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
                -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
-               -DSHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_C="\"sha1dc_git.c\"" \
-               -DSHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_H="\"sha1dc_git.h\"" \
                -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
  endif
  endif
  endif
  endif
+ endif
  
  ifdef SHA1_MAX_BLOCK_SIZE
        LIB_OBJS += compat/sha1-chunked.o
@@@ -2040,6 -2049,7 +2052,6 @@@ XDIFF_OBJS += xdiff/xhistogram.
  
  VCSSVN_OBJS += vcs-svn/line_buffer.o
  VCSSVN_OBJS += vcs-svn/sliding_window.o
 -VCSSVN_OBJS += vcs-svn/repo_tree.o
  VCSSVN_OBJS += vcs-svn/fast_export.o
  VCSSVN_OBJS += vcs-svn/svndiff.o
  VCSSVN_OBJS += vcs-svn/svndump.o