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
@ -565,7 +565,8 @@ static int add_graph_to_chain(struct commit_graph *g,
|
||||
|
||||
if (!cur_g ||
|
||||
!oideq(&oids[n], &cur_g->oid) ||
|
||||
!hasheq(oids[n].hash, g->chunk_base_graphs + st_mult(g->hash_len, n))) {
|
||||
!hasheq(oids[n].hash, g->chunk_base_graphs + st_mult(g->hash_len, n),
|
||||
the_repository->hash_algo)) {
|
||||
warning(_("commit-graph chain does not match"));
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user