reftable: implement record equality generically

This simplifies unittests a little, and provides further coverage for
reftable_record_copy().

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Han-Wen Nienhuys
2022-01-20 15:12:11 +00:00
committed by Junio C Hamano
parent a94b94506b
commit c983374035
3 changed files with 63 additions and 22 deletions

View File

@ -58,6 +58,9 @@ struct reftable_record_vtable {
/* is this a tombstone? */
int (*is_deletion)(const void *rec);
/* Are two records equal? This assumes they have the same type. Returns 0 for non-equal. */
int (*equal)(const void *a, const void *b, int hash_size);
};
/* record is a generic wrapper for different types of records. */
@ -98,7 +101,7 @@ struct reftable_obj_record {
};
/* see struct record_vtable */
int reftable_record_equal(struct reftable_record *a, struct reftable_record *b, int hash_size);
void reftable_record_key(struct reftable_record *rec, struct strbuf *dest);
uint8_t reftable_record_type(struct reftable_record *rec);
void reftable_record_copy_from(struct reftable_record *rec,