reftable/system: stop depending on "hash.h"
We include "hash.h" in "reftable/system.h" such that we can use hash format IDs as well as the raw size of SHA1 and SHA256. As we are in the process of converting the reftable library to become standalone we of course cannot rely on those constants anymore. Introduce a new `enum reftable_hash` to replace internal uses of the hash format IDs and new constants that replace internal uses of the hash size. Adapt the reftable backend to set up the correct hash function. 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
88e297275b
commit
c2f08236ed
@ -73,7 +73,7 @@ int reftable_new_stack(struct reftable_stack **dest, const char *dir,
|
||||
if (_opts)
|
||||
opts = *_opts;
|
||||
if (opts.hash_id == 0)
|
||||
opts.hash_id = GIT_SHA1_FORMAT_ID;
|
||||
opts.hash_id = REFTABLE_HASH_SHA1;
|
||||
|
||||
*dest = NULL;
|
||||
|
||||
@ -1603,7 +1603,7 @@ struct segment suggest_compaction_segment(uint64_t *sizes, size_t n,
|
||||
|
||||
static uint64_t *stack_table_sizes_for_compaction(struct reftable_stack *st)
|
||||
{
|
||||
int version = (st->opts.hash_id == GIT_SHA1_FORMAT_ID) ? 1 : 2;
|
||||
int version = (st->opts.hash_id == REFTABLE_HASH_SHA1) ? 1 : 2;
|
||||
int overhead = header_size(version) - 1;
|
||||
uint64_t *sizes;
|
||||
|
||||
|
Reference in New Issue
Block a user