Subject: Re: [PATCH v2 3/5] refs/reftable: add fsck check for number of tables

From: Patrick Steinhardt <[email-masked]>
Date: Wed, 3 Sep 2025 10:07:19 +0200

On Tue, Sep 02, 2025 at 09:05:23AM +0200, Karthik Nayak wrote:
> Introduce a reftable fsck check to check that the number of files in the
> reftable directory matches the number of files listed in 'tables.list'.
> We do this by iterating over the files in the reftable directory and
> counting all the files present excluding the 'tables.list'. This is also
> exposed over Git's fsck checks as a 'badReftableStackCount' error.

This feels overly strict, as it can always be the case that a concurrent
process is currently updating the stack. Furthermore, it's expected that
on Windows systems deletion of an old table may not work because the
file is still kept open by another process. The reftable library is
prepared to handle this alright and will re-try deleting the table at a
later point in time.

So maybe a better check would be to verify that there are no files with
unexpected names in the directory?

Patrick