Subject: Re: [PATCH v4 6/7] reftable: add code to facilitate consistency checks

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 2 Oct 2025 13:44:30 +0200

On Fri, Sep 26, 2025 at 09:25:49AM +0200, Karthik Nayak wrote:
> diff --git a/reftable/fsck.c b/reftable/fsck.c
> new file mode 100644
> index 0000000000..26b9115b14
> --- /dev/null
> +++ b/reftable/fsck.c
> @@ -0,0 +1,100 @@
[snip]
> +static int table_checks(struct reftable_table *table,
> +			reftable_fsck_report_fn report_fn,
> +			reftable_fsck_verbose_fn verbose_fn UNUSED,
> +			void *cb_data)
> +{
> +	table_check_fn table_check_fns[] = {
> +		table_check_name,
> +		NULL,
> +	};
> +	int err = 0;
> +
> +	for (size_t i = 0; table_check_fns[i]; i++)
> +		err |= table_check_fns[i](table, report_fn, cb_data);
> +
> +	return err;
> +}

Okay, good. We now only verify individual table names part of the stack,
and don't scan the directory anymore. Furthermore, it is easy to add
more tests by adding to the function array.

Patrick