]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ps/hash-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Mon, 10 Feb 2025 18:18:30 +0000 (10:18 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Feb 2025 18:18:31 +0000 (10:18 -0800)
Further code clean-up on the use of hash functions.  Now the
context object knows what hash function it is working with.

* ps/hash-cleanup:
  global: adapt callers to use generic hash context helpers
  hash: provide generic wrappers to update hash contexts
  hash: stop typedeffing the hash context
  hash: convert hashing context to a structure

1  2 
builtin/fast-import.c
builtin/index-pack.c
builtin/receive-pack.c
bulk-checkin.c
csum-file.c
diff.h
pack-write.c

Simple merge
Simple merge
Simple merge
diff --cc bulk-checkin.c
Simple merge
diff --cc csum-file.c
Simple merge
diff --cc diff.h
Simple merge
diff --cc pack-write.c
index a2faeb1895e41f4c17281380478f1f2cabcc6f24,cfcb7297b891418586aeeb3f4582ea52f9109203..d61e29ba4ef4eb6ed3242b825f8a2d0ffaa58901
@@@ -443,8 -436,9 +443,9 @@@ void fixup_pack_header_footer(const str
                partial_pack_offset -= n;
                if (partial_pack_offset == 0) {
                        unsigned char hash[GIT_MAX_RAWSZ];
-                       hash_algo->final_fn(hash, &old_hash_ctx);
-                       if (!hasheq(hash, partial_pack_hash, hash_algo))
+                       git_hash_final(hash, &old_hash_ctx);
+                       if (!hasheq(hash, partial_pack_hash,
 -                                  the_repository->hash_algo))
++                                  hash_algo))
                                die("Unexpected checksum for %s "
                                    "(disk corruption?)", pack_name);
                        /*
        free(buf);
  
        if (partial_pack_hash)
-               hash_algo->final_fn(partial_pack_hash, &old_hash_ctx);
-       hash_algo->final_fn(new_pack_hash, &new_hash_ctx);
+               git_hash_final(partial_pack_hash, &old_hash_ctx);
+       git_hash_final(new_pack_hash, &new_hash_ctx);
 -      write_or_die(pack_fd, new_pack_hash, the_hash_algo->rawsz);
 +      write_or_die(pack_fd, new_pack_hash, hash_algo->rawsz);
        fsync_component_or_die(FSYNC_COMPONENT_PACK, pack_fd, pack_name);
  }