]> git.ipfire.org Git - thirdparty/git.git/blobdiff - pack-check.c
t6050: use git-update-ref rather than filesystem access
[thirdparty/git.git] / pack-check.c
index 4b089fe8ec051af05044225c283ee5ff3c1dac84..c8e560d71ab7e558da1a332d0640e6a71df5ac8c 100644 (file)
@@ -164,22 +164,13 @@ static int verify_packfile(struct repository *r,
 
 int verify_pack_index(struct packed_git *p)
 {
-       size_t len;
-       const unsigned char *index_base;
-       git_hash_ctx ctx;
-       unsigned char hash[GIT_MAX_RAWSZ];
        int err = 0;
 
        if (open_pack_index(p))
                return error("packfile %s index not opened", p->pack_name);
-       index_base = p->index_data;
-       len = p->index_size - the_hash_algo->rawsz;
 
        /* Verify SHA1 sum of the index file */
-       the_hash_algo->init_fn(&ctx);
-       the_hash_algo->update_fn(&ctx, index_base, len);
-       the_hash_algo->final_fn(hash, &ctx);
-       if (!hasheq(hash, index_base + len))
+       if (!hashfile_checksum_valid(p->index_data, p->index_size))
                err = error("Packfile index for %s hash mismatch",
                            p->pack_name);
        return err;