]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pack-check: use given repo's hash_algo at verify_packfile()
authorMatheus Tavares <matheus.bernardino@usp.br>
Thu, 30 Jan 2020 20:32:19 +0000 (17:32 -0300)
committerJunio C Hamano <gitster@pobox.com>
Fri, 31 Jan 2020 18:45:39 +0000 (10:45 -0800)
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>
pack-check.c

index 2cc3603189b8cd27781fd16cba2eb10a16817038..0fb3b365c7d13c07b1b495a89a1e62119c1d07d8 100644 (file)
@@ -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);