pack-check: use given repo's hash_algo at verify_packfile()
At verify_packfile(), use the git_hash_algo from the provided repository instead of the_hash_algo, for consistency. Like the previous patch, this shouldn't bring any behavior changes, since this function is currently only receiving the_repository. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matheus Tavares committed
Jan 30, 2020 at 17:32 UTC
5ec9b8accd6591641115d692fe2e9c4b88019d97
1 file changed
+5
-5
pack-check.c
+5
-5
@@ -67,23 +67,23 @@ static int verify_packfile(struct repository *r,
67
if (!is_pack_valid(p))
68
return error("packfile %s cannot be accessed", p->pack_name);
69
70
- the_hash_algo->init_fn(&ctx);
70
+ r->hash_algo->init_fn(&ctx);
71
do {
72
unsigned long remaining;
73
unsigned char *in = use_pack(p, w_curs, offset, &remaining);
74
offset += remaining;
75
if (!pack_sig_ofs)
76
- pack_sig_ofs = p->pack_size - the_hash_algo->rawsz;
76
+ pack_sig_ofs = p->pack_size - r->hash_algo->rawsz;
77
if (offset > pack_sig_ofs)
78
remaining -= (unsigned int)(offset - pack_sig_ofs);
79
- the_hash_algo->update_fn(&ctx, in, remaining);
79
+ r->hash_algo->update_fn(&ctx, in, remaining);
80
} while (offset < pack_sig_ofs);
81
- the_hash_algo->final_fn(hash, &ctx);
81
+ r->hash_algo->final_fn(hash, &ctx);
82
pack_sig = use_pack(p, w_curs, pack_sig_ofs, NULL);
83
if (!hasheq(hash, pack_sig))
84
err = error("%s pack checksum mismatch",
85
p->pack_name);
86
- if (!hasheq(index_base + index_size - the_hash_algo->hexsz, pack_sig))
86
+ if (!hasheq(index_base + index_size - r->hash_algo->hexsz, pack_sig))
87
err = error("%s pack checksum does not match its index",
88
p->pack_name);
89
unuse_pack(w_curs);