Skip to content

Commit 5ec9b8a

Browse files
matheustavaresgitster
authored andcommitted
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>
1 parent a651946 commit 5ec9b8a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pack-check.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,23 @@ static int verify_packfile(struct repository *r,
6767
if (!is_pack_valid(p))
6868
return error("packfile %s cannot be accessed", p->pack_name);
6969

70-
the_hash_algo->init_fn(&ctx);
70+
r->hash_algo->init_fn(&ctx);
7171
do {
7272
unsigned long remaining;
7373
unsigned char *in = use_pack(p, w_curs, offset, &remaining);
7474
offset += remaining;
7575
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;
7777
if (offset > pack_sig_ofs)
7878
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);
8080
} while (offset < pack_sig_ofs);
81-
the_hash_algo->final_fn(hash, &ctx);
81+
r->hash_algo->final_fn(hash, &ctx);
8282
pack_sig = use_pack(p, w_curs, pack_sig_ofs, NULL);
8383
if (!hasheq(hash, pack_sig))
8484
err = error("%s pack checksum mismatch",
8585
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))
8787
err = error("%s pack checksum does not match its index",
8888
p->pack_name);
8989
unuse_pack(w_curs);

0 commit comments

Comments
 (0)