]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'bc/sha-256'
authorJunio C Hamano <gitster@pobox.com>
Tue, 29 Jan 2019 20:47:55 +0000 (12:47 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 Jan 2019 20:47:55 +0000 (12:47 -0800)
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"

1  2 
Makefile
cache.h
commit-graph.c
sha1-file.c
t/helper/test-tool.c
t/helper/test-tool.h

diff --cc Makefile
Simple merge
diff --cc cache.h
Simple merge
diff --cc commit-graph.c
index 0d6ba6da2d76fa3a5d43dae74fc1bb7b652c6df0,7a28fbb03fd71a0d22613c73d0621129e121f88b..3f9c03afd57ef1b45a1aa65f648f4cf153aaad96
  #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);
        }
  
        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);
  
diff --cc sha1-file.c
Simple merge
Simple merge
Simple merge