]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/record: don't `BUG()` in `reftable_record_cmp()`
authorPatrick Steinhardt <ps@pks.im>
Tue, 18 Feb 2025 09:20:42 +0000 (10:20 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Feb 2025 18:55:36 +0000 (10:55 -0800)
commit6f6127decde6785b9ba5f22a07a7754d1fda1a59
treed65310107cc06522840061d534e93e7e8d38e666
parent9d9fac0f34ec47cc6eafeb3e10378ab8f3310346
reftable/record: don't `BUG()` in `reftable_record_cmp()`

The reftable library aborts with a bug in case `reftable_record_cmp()`
is invoked with two records of differing types. This would cause the
program to die without the caller being able to handle the error, which
is not something we want in the context of library code. And it ties us
to the Git codebase.

Refactor the code such that `reftable_record_cmp()` returns an error
code separate from the actual comparison result. This requires us to
also adapt some callers up the callchain in a similar fashion.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/merged.c
reftable/pq.c
reftable/pq.h
reftable/record.c
reftable/record.h
t/unit-tests/t-reftable-pq.c
t/unit-tests/t-reftable-record.c