From: Junio C Hamano Date: Tue, 29 Jan 2019 20:47:55 +0000 (-0800) Subject: Merge branch 'bc/sha-256' X-Git-Tag: v2.21.0-rc0~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33e4ae9c50;p=thirdparty%2Fgit.git Merge branch 'bc/sha-256' Add sha-256 hash and plug it through the code to allow building Git with the "NewHash". * bc/sha-256: hash: add an SHA-256 implementation using OpenSSL sha256: add an SHA-256 implementation using libgcrypt Add a base implementation of SHA-256 support commit-graph: convert to using the_hash_algo t/helper: add a test helper to compute hash speed sha1-file: add a constant for hash block size t: make the sha1 test-tool helper generic t: add basic tests for our SHA-1 implementation cache: make hashcmp and hasheq work with larger hashes hex: introduce functions to print arbitrary hashes sha1-file: provide functions to look up hash algorithms sha1-file: rename algorithm to "sha1" --- 33e4ae9c509e0ecdc6508475f2974d275539616e diff --cc commit-graph.c index 0d6ba6da2d,7a28fbb03f..3f9c03afd5 --- a/commit-graph.c +++ b/commit-graph.c @@@ -28,12 -25,8 +28,7 @@@ #define GRAPH_VERSION_1 0x1 #define GRAPH_VERSION GRAPH_VERSION_1 - #define GRAPH_OID_VERSION_SHA1 1 - #define GRAPH_OID_LEN_SHA1 GIT_SHA1_RAWSZ - #define GRAPH_OID_VERSION GRAPH_OID_VERSION_SHA1 - #define GRAPH_OID_LEN GRAPH_OID_LEN_SHA1 - #define GRAPH_OCTOPUS_EDGES_NEEDED 0x80000000 -#define GRAPH_PARENT_MISSING 0x7fffffff #define GRAPH_EDGE_LAST_MASK 0x7fffffff #define GRAPH_PARENT_NONE 0x70000000 @@@ -772,15 -711,10 +772,16 @@@ void write_commit_graph(const char *obj int num_chunks; int num_extra_edges; struct commit_list *parent; + struct progress *progress = NULL; + const unsigned hashsz = the_hash_algo->rawsz; + if (!commit_graph_compatible(the_repository)) + return; + oids.nr = 0; - oids.alloc = approximate_object_count() / 4; + oids.alloc = approximate_object_count() / 32; + oids.progress = NULL; + oids.progress_done = 0; if (append) { prepare_commit_graph_one(the_repository, obj_dir); @@@ -947,11 -861,11 +948,11 @@@ } write_graph_chunk_fanout(f, commits.list, commits.nr); - write_graph_chunk_oids(f, GRAPH_OID_LEN, commits.list, commits.nr); - write_graph_chunk_data(f, GRAPH_OID_LEN, commits.list, commits.nr); + write_graph_chunk_oids(f, hashsz, commits.list, commits.nr); + write_graph_chunk_data(f, hashsz, commits.list, commits.nr); write_graph_chunk_large_edges(f, commits.list, commits.nr); - close_commit_graph(); + close_commit_graph(the_repository); finalize_hashfile(f, NULL, CSUM_HASH_IN_STREAM | CSUM_FSYNC); commit_lock_file(&lk);