aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/unpack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-02-10 10:18:30 -0800
committerJunio C Hamano <gitster@pobox.com>2025-02-10 10:18:31 -0800
commit246569bf83f2a586268d26559c7d6ea54c9316b6 (patch)
tree29bdf8fd459a337adef85012b88d6ed71830a147 /builtin/unpack-objects.c
parent0ca6b46d7ca17988da3b7292097e5608be81abad (diff)
parent0578f1e66aa381356bfe2f53decf3864d88d23d3 (diff)
downloadgit-246569bf83f2a586268d26559c7d6ea54c9316b6.tar.gz
Merge branch 'ps/hash-cleanup'
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
Diffstat (limited to 'builtin/unpack-objects.c')
-rw-r--r--builtin/unpack-objects.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index f6b9825fb0..8383bcf404 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -28,7 +28,7 @@ static unsigned char buffer[4096];
static unsigned int offset, len;
static off_t consumed_bytes;
static off_t max_input_size;
-static git_hash_ctx ctx;
+static struct git_hash_ctx ctx;
static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT;
static struct progress *progress;
@@ -70,7 +70,7 @@ static void *fill(int min)
if (min > sizeof(buffer))
die("cannot fill %d bytes", min);
if (offset) {
- the_hash_algo->update_fn(&ctx, buffer, offset);
+ git_hash_update(&ctx, buffer, offset);
memmove(buffer, buffer + offset, len);
offset = 0;
}
@@ -614,7 +614,7 @@ int cmd_unpack_objects(int argc,
{
int i;
struct object_id oid;
- git_hash_ctx tmp_ctx;
+ struct git_hash_ctx tmp_ctx;
disable_replace_refs();
@@ -667,10 +667,9 @@ int cmd_unpack_objects(int argc,
}
the_hash_algo->init_fn(&ctx);
unpack_all();
- the_hash_algo->update_fn(&ctx, buffer, offset);
- the_hash_algo->init_fn(&tmp_ctx);
- the_hash_algo->clone_fn(&tmp_ctx, &ctx);
- the_hash_algo->final_oid_fn(&oid, &tmp_ctx);
+ git_hash_update(&ctx, buffer, offset);
+ git_hash_clone(&tmp_ctx, &ctx);
+ git_hash_final_oid(&oid, &tmp_ctx);
if (strict) {
write_rest();
if (fsck_finish(&fsck_options))