path: root/sha1dc_git.c
diff options
authorTakashi Iwai <>2017-08-15 12:04:16 (GMT)
committerJunio C Hamano <>2017-08-16 21:43:59 (GMT)
commit36f048c5e488005da0a9dfba6b617c7c9951c7cf (patch)
treeee859ed5ef5bfb9358967e87ce69a1f8ba84856a /sha1dc_git.c
parent5800c63717ae35286a1441f14ffff753e01f7e2b (diff)
sha1dc: build git plumbing code more explicitly
The plumbing code between sha1dc and git is defined in sha1dc_git.[ch], but these aren't compiled / included directly but only via the indirect inclusion from sha1dc code. This is slightly confusing when you try to trace the build flow. This patch brings the following changes for simplification: - Make sha1dc_git.c stand-alone and build from Makefile - sha1dc_git.h is the common header to include further sha1.h depending on the build condition - Move comments for plumbing codes from the header to definitions This is also meant as a preliminary work for further plumbing with external sha1dc shlib. Signed-off-by: Takashi Iwai <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'sha1dc_git.c')
1 files changed, 6 insertions, 3 deletions
diff --git a/sha1dc_git.c b/sha1dc_git.c
index 4d32b4f..7946641 100644
--- a/sha1dc_git.c
+++ b/sha1dc_git.c
@@ -1,8 +1,8 @@
+#include "cache.h"
- * This code is included at the end of sha1dc/sha1.c with the
+ * Same as SHA1DCFinal, but convert collision attack case into a verbose die().
void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx)
if (!SHA1DCFinal(hash, ctx))
@@ -11,6 +11,9 @@ void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx)
+ * Same as SHA1DCUpdate, but adjust types to match git's usual interface.
+ */
void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *vdata, unsigned long len)
const char *data = vdata;