This series adds the required infrastructure and also some fsck checks for the reftable backend. Since the reftable backend is treated as a library within the Git codebase, we don't want to spillover our internal fsck implementation into the library. At the same time, the fsck checks need to access internal structures of the reftable library which aren't exposed outside the library. So we solve this by adding a 'reftable/fsck.[ch]' which implements and exposes a checker for the reftable library and returns specific errors as defined by the library. We then add glue code within 'refs/reftable-backend.c' to map these errors to errors which Git's fsck implementation would understand. This allows us to separate concerns. This series then adds some checks on the stack ('reftable/tables.list') level of reftable, namely: 1. The table name is as per the spec 2. The number of tables are consistent 3. The tables.list has a newline at the end of file 4. The table names follow correct index sequences I also plan to send in follow up series's which will implement further checks and go into deeper layers (tables, block, references). Signed-off-by: Karthik Nayak <karthik.188@xxxxxxxxx> --- Documentation/fsck-msgids.adoc | 15 +++- Makefile | 1 + fsck.h | 154 +++++++++++++++++++++-------------------- meson.build | 1 + refs/reftable-backend.c | 70 +++++++++++++++++-- reftable/fsck.c | 132 +++++++++++++++++++++++++++++++++++ reftable/reftable-fsck.h | 44 ++++++++++++ t/meson.build | 3 +- t/t0614-reftable-fsck.sh | 138 ++++++++++++++++++++++++++++++++++++ 9 files changed, 473 insertions(+), 85 deletions(-) Karthik Nayak (5): fsck: order 'fsck_msg_type' alphabetically refs/reftable: add fsck check for checking the table name refs/reftable: add fsck check for number of tables refs/reftable: add fsck check for trailing newline refs/reftable: add fsck check for incorrect update index base-commit: c44beea485f0f2feaf460e2ac87fdd5608d63cf0 change-id: 20250714-228-reftable-introduce-consistency-checks-379ded93c544 Thanks - Karthik