On Sun, Jan 05, 2025 at 09:49:09PM +0800, shejialuo wrote: > Although we use "parse_loose_ref_content" to check whether the object id > is correct, we never parse it into the "struct object" structure thus we > ignore checking whether there is a real object existing in the repo and > whether the object type is correct. > > Use "parse_object" to parse the oid for the regular ref content. If the > object does not exist, report the error to the user by reusing the fsck > message "BAD_REF_CONTENT". > > Then, we need to check the type of the object. Just like "git-fsck(1)", > we only report "not a commit" error when the ref is a branch. Last, > update the test to exercise the code. I wonder whether it wouldn't make more sense to put this into a generic part of `git refs verify`. This isn't a check for whether the format of the files backend is correct, but rather a check whether the refdb is sane. As such, it also applies do the reftable backend. So should we maybe extend `git refs verify` so that it also knows to perform generic checks that apply independent of the backend in use? Patrick