hash: require hash algorithm in hasheq()
, hashcmp()
and hashclr()
Many of our hash functions have two variants, one receiving a `struct git_hash_algo` and one that derives it via `the_repository`. Adapt all of those functions to always require the hash algorithm as input and drop the variants that do not accept one. As those functions are now independent of `the_repository`, we can move them from "hash.h" to "hash-ll.h". Note that both in this and subsequent commits in this series we always just pass `the_repository->hash_algo` as input even if it is obvious that there is a repository in the context that we should be using the hash from instead. This is done to be on the safe side and not introduce any regressions. All callsites should eventually be amended to use a repo passed via parameters, but this is outside the scope of this patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
129cb1b99d
commit
f4836570a7
@ -367,7 +367,8 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
|
||||
if (load_bitmap_header(bitmap_git) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!hasheq(get_midx_checksum(bitmap_git->midx), bitmap_git->checksum)) {
|
||||
if (!hasheq(get_midx_checksum(bitmap_git->midx), bitmap_git->checksum,
|
||||
the_repository->hash_algo)) {
|
||||
error(_("checksum doesn't match in MIDX and bitmap"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
Reference in New Issue
Block a user