aboutsummaryrefslogtreecommitdiffstats
path: root/pack-check.c
diff options
context:
space:
mode:
Diffstat (limited to 'pack-check.c')
-rw-r--r--pack-check.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/pack-check.c b/pack-check.c
index 8d9f6da7ce..874897d6cb 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -1,4 +1,3 @@
-#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
@@ -9,7 +8,7 @@
#include "progress.h"
#include "packfile.h"
#include "object-file.h"
-#include "object-store-ll.h"
+#include "object-store.h"
struct idx_entry {
off_t offset;
@@ -44,7 +43,7 @@ int check_pack_crc(struct packed_git *p, struct pack_window **w_curs,
} while (len);
index_crc = p->index_data;
- index_crc += 2 + 256 + (size_t)p->num_objects * (the_hash_algo->rawsz/4) + nr;
+ index_crc += 2 + 256 + (size_t)p->num_objects * (p->repo->hash_algo->rawsz/4) + nr;
return data_crc != ntohl(*index_crc);
}
@@ -58,7 +57,7 @@ static int verify_packfile(struct repository *r,
{
off_t index_size = p->index_size;
const unsigned char *index_base = p->index_data;
- git_hash_ctx ctx;
+ struct git_hash_ctx ctx;
unsigned char hash[GIT_MAX_RAWSZ], *pack_sig;
off_t offset = 0, pack_sig_ofs = 0;
uint32_t nr_objects, i;
@@ -77,15 +76,15 @@ static int verify_packfile(struct repository *r,
pack_sig_ofs = p->pack_size - r->hash_algo->rawsz;
if (offset > pack_sig_ofs)
remaining -= (unsigned int)(offset - pack_sig_ofs);
- r->hash_algo->update_fn(&ctx, in, remaining);
+ git_hash_update(&ctx, in, remaining);
} while (offset < pack_sig_ofs);
- r->hash_algo->final_fn(hash, &ctx);
+ git_hash_final(hash, &ctx);
pack_sig = use_pack(p, w_curs, pack_sig_ofs, NULL);
- if (!hasheq(hash, pack_sig, the_repository->hash_algo))
+ if (!hasheq(hash, pack_sig, r->hash_algo))
err = error("%s pack checksum mismatch",
p->pack_name);
if (!hasheq(index_base + index_size - r->hash_algo->hexsz, pack_sig,
- the_repository->hash_algo))
+ r->hash_algo))
err = error("%s pack checksum does not match its index",
p->pack_name);
unuse_pack(w_curs);
@@ -131,7 +130,8 @@ static int verify_packfile(struct repository *r,
type = unpack_object_header(p, w_curs, &curpos, &size);
unuse_pack(w_curs);
- if (type == OBJ_BLOB && big_file_threshold <= size) {
+ if (type == OBJ_BLOB &&
+ repo_settings_get_big_file_threshold(r) <= size) {
/*
* Let stream_object_signature() check it with
* the streaming interface; no point slurping
@@ -180,7 +180,7 @@ int verify_pack_index(struct packed_git *p)
return error("packfile %s index not opened", p->pack_name);
/* Verify SHA1 sum of the index file */
- if (!hashfile_checksum_valid(p->index_data, p->index_size))
+ if (!hashfile_checksum_valid(p->repo->hash_algo, p->index_data, p->index_size))
err = error("Packfile index for %s hash mismatch",
p->pack_name);
return err;