Re: [RFC] Implement ref content consistency check
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 16, 2024, 16:39 UTC
- Message-ID
- <xmqqzfpcl8wf.fsf@gitster.g>
- In-Reply-To
- <Zr8Wkudjn5n1Zm0y@tanuki>
Patrick Steinhardt <ps@pks.im> writes:
Show 15 quoted lines
>> > > 1. For the regular ref which has a trailing garbage, we should warn the >> > > user. This is the most simplest situation, we could reply on >> > > "parse_loose_ref_content" to do this. >> > > 2. For the symref, we could also rely on "parse_loose_ref_content" to >> > > get the "pointee", and check the location of the "pointee", check the >> > > name of the "pointee" and the file type of the "pointee". >> > > 3. FOr the symbolic ref, we could follow the idea of 2. >> > >> > Just to understand clearly, when you're talking about 'symbolic ref' you >> > are referring to symbolic links? >> >> I am sorry about this. It's symbolic links here. > > Wait, is it really symbolic link? I don't think so, you actually were > talking about symbolic refs correctly.
In #2, yes. I think #3 is about what to do with a random symbolic link inside or near .git/refs/ hierarchy, which may or may not meant as a symref. I agree that we should assume that the user meant them to be used as symrefs, check its validity the same way as a textual symrefs, and complain if they look bogus.
> And checking the format of both normal and symbolic refs does make sense > in my opinion.
Yup.