diff options
author | Matheus Tavares <matheus.bernardino@usp.br> | 2020-01-30 21:32:19 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-01-31 19:45:39 +0100 |
commit | 5ec9b8accd6591641115d692fe2e9c4b88019d97 (patch) | |
tree | 1c3b9c04c605f7504be9cb94bd1a940b65f2edb3 /pack-check.c | |
parent | cache-tree: use given repo's hash_algo at verify_one() (diff) | |
download | git-5ec9b8accd6591641115d692fe2e9c4b88019d97.tar.xz git-5ec9b8accd6591641115d692fe2e9c4b88019d97.zip |
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>
Diffstat (limited to 'pack-check.c')
-rw-r--r-- | pack-check.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pack-check.c b/pack-check.c index 2cc3603189..0fb3b365c7 100644 --- a/pack-check.c +++ b/pack-check.c @@ -67,23 +67,23 @@ static int verify_packfile(struct repository *r, if (!is_pack_valid(p)) return error("packfile %s cannot be accessed", p->pack_name); - the_hash_algo->init_fn(&ctx); + r->hash_algo->init_fn(&ctx); do { unsigned long remaining; unsigned char *in = use_pack(p, w_curs, offset, &remaining); offset += remaining; if (!pack_sig_ofs) - pack_sig_ofs = p->pack_size - the_hash_algo->rawsz; + pack_sig_ofs = p->pack_size - r->hash_algo->rawsz; if (offset > pack_sig_ofs) remaining -= (unsigned int)(offset - pack_sig_ofs); - the_hash_algo->update_fn(&ctx, in, remaining); + r->hash_algo->update_fn(&ctx, in, remaining); } while (offset < pack_sig_ofs); - the_hash_algo->final_fn(hash, &ctx); + r->hash_algo->final_fn(hash, &ctx); pack_sig = use_pack(p, w_curs, pack_sig_ofs, NULL); if (!hasheq(hash, pack_sig)) err = error("%s pack checksum mismatch", p->pack_name); - if (!hasheq(index_base + index_size - the_hash_algo->hexsz, pack_sig)) + if (!hasheq(index_base + index_size - r->hash_algo->hexsz, pack_sig)) err = error("%s pack checksum does not match its index", p->pack_name); unuse_pack(w_curs); |