Subject: Re: [PATCH v5 0/7] refs/reftable: add consistency checks

From: Junio C Hamano <[email-masked]>
Date: Mon, 06 Oct 2025 15:08:09 -0700

Karthik Nayak <[email-masked]> writes:

> The reference subsystems allows for adding backend specific consistency
> checks. These checks are run as part of 'git refs verify'.
>
> While the files backend has some consistency checks added, the reftable
> backend currently has none. This series first tightens the reftable
> backend to make it a little more strict and then also adds the required
> infrastructure and some simple consistency checks.
>
> 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.
>
> We add the following consistency checks:
>
>   1. Check for validating the reftable table name. This is treated as a
>   warning since the reftable specification only suggests a table name
>   but doesn't enforce it. Also there is a difference in the table name
>   used in Git vs that in jGit.
>
> We tighten the reftable backend by raising a REFTABLE_FORMAT_ERROR error
> when:
>
> 1. The 'tables.list' file doesn't have a trailing newline.
>
> ---
> Changes in v5:
> - Added documentation around the return value of 'parse_names()'.
> - Added a test to validate that 'git refs verify' doesn't barf against
>   a clean working repository with multiple reftable tables.
> - Link to v4: https://lore.kernel.org/all/2025[email-masked]

Looking good.  Shall we declare victory and mark the topic for
'next' now?

Thanks.