зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
a651946730
Коммит
5ec9b8accd
10
pack-check.c
10
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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче