fsck: create scaffolding for rev-index checks

The 'fsck' builtin checks many of Git's on-disk data structures, but
does not currently validate the pack rev-index files (a .rev file to
pair with a .pack and .idx file).

Before doing a more-involved check process, create the scaffolding
within builtin/fsck.c to have a new error type and add that error type
when the API method verify_pack_revindex() returns an error. That method
does nothing currently, but we will add checks to it in later changes.

For now, check that 'git fsck' succeeds without any errors in the normal
case. Future checks will be paired with tests that corrupt the .rev file
appropriately.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Derrick Stolee
2023-04-17 16:21:38 +00:00
committed by Junio C Hamano
parent 3c63503759
commit 0d30feef3c
4 changed files with 63 additions and 0 deletions

View File

@@ -301,6 +301,17 @@ int load_pack_revindex(struct repository *r, struct packed_git *p)
return -1;
}
/*
* verify_pack_revindex verifies that the on-disk rev-index for the given
* pack-file is the same that would be created if written from scratch.
*
* A negative number is returned on error.
*/
int verify_pack_revindex(struct packed_git *p)
{
return 0;
}
int load_midx_revindex(struct multi_pack_index *m)
{
struct strbuf revindex_name = STRBUF_INIT;