diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-06-14 08:49:50 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-06-14 19:26:32 +0200 |
commit | f4836570a7adbd8c70ad7a8edf6ae5a977647c06 (patch) | |
tree | 568c8b46cc7324a45e2c1d42f07ed80b36bf1230 /hash-lookup.c | |
parent | hash: drop (mostly) unused `is_empty_{blob,tree}_sha1()` functions (diff) | |
download | git-f4836570a7adbd8c70ad7a8edf6ae5a977647c06.tar.xz git-f4836570a7adbd8c70ad7a8edf6ae5a977647c06.zip |
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>
Diffstat (limited to 'hash-lookup.c')
-rw-r--r-- | hash-lookup.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/hash-lookup.c b/hash-lookup.c index 9f0f95e2b9..9aa6b82eb7 100644 --- a/hash-lookup.c +++ b/hash-lookup.c @@ -112,7 +112,8 @@ int bsearch_hash(const unsigned char *hash, const uint32_t *fanout_nbo, while (lo < hi) { unsigned mi = lo + (hi - lo) / 2; - int cmp = hashcmp(table + mi * stride, hash); + int cmp = hashcmp(table + mi * stride, hash, + the_repository->hash_algo); if (!cmp) { if (result) |