Subject: Re: [PATCH 04/10] packed-backend: add "packed-refs" header consistency check

From: shejialuo <[email-masked]>
Date: Wed, 8 Jan 2025 08:54:14 +0800

On Sun, Jan 05, 2025 at 09:49:37PM +0800, shejialuo wrote:

[snip]

> However, when adding the new test for a bad header, the program will
> still die in the "create_snapshot" method. This is because we have
> checked the files-backend firstly and we use "parse_object" to check
> whether the object exists and whether the type is correct. This function
> will eventually call "create_snapshot" and "next_record" method, if
> there is something wrong with packed-backend, the program just dies.
> 
> It's bad to just die the program because we want to report the problems
> as many as possible. We should avoid checking object and its type when
> packed-backend is broken. So, we should first check the consistency of
> the packed-backend then for files-backend.
> 
> Add a new flag "safe_object_check" in "fsck_options", when there is
> anything wrong with the parsing process, set this flag to 0 to avoid
> checking objects in the later checks.
> 

Here, I made a mistake. The most simplest way is to call the
"disable_replace_refs" function in "builtin/refs". So, there is a lot of
code and commit message needs to be fixed in the version 2. I have just
realized about this.

So, tell the reviewers in advance about this.

Thanks,
Jialuo