Subject: Re: [PATCH 07/10] packed-backend: create "fsck_packed_ref_entry" to store parsing info

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 16 Jan 2025 14:57:46 +0100

On Sun, Jan 05, 2025 at 09:50:10PM +0800, shejialuo wrote:
> We have already check whether the oid hash is correct by using
> `parse_oid_hex_algop`. However, we doesn't check whether the object
> exists. It may seem that we could do this when we are parsing the raw
> "packed-refs" file. But this is impossible. Let's analysis why.
> 
> We will use "parse_object" function to get the "struct object". However,
> this function will eventually call the "create_snapshot" and
> "next_record" function in "packed-backend.c". If there is anything
> wrong, it will die the program. And we don't want to die the program
> during the check.
> 
> So, we should store the information in the parsing process. And if there
> is nothing wrong in the parsing process, we could continue to check
> things. So, create "fsck_packed_ref_entry" to do this.

This step can be avoided if we made the check generic.

Patrick