]> git.ipfire.org Git - thirdparty/git.git/commit
packed-backend: add "packed-refs" entry consistency check
authorshejialuo <shejialuo@gmail.com>
Thu, 27 Feb 2025 16:07:17 +0000 (00:07 +0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Feb 2025 22:03:08 +0000 (14:03 -0800)
commite6ba4c07b85a0a8fee84b6ac7ab414d47a5351f2
tree7b341b4e6181794ce6df312b06deb345d9a984c2
parent5637d5542021294e81cf0d8344fe140368117296
packed-backend: add "packed-refs" entry consistency check

"packed-backend.c::next_record" will parse the ref entry to check the
consistency. This function has already checked the following things:

1. Parse the main line of the ref entry to inspect whether the oid is
   not correct. Then, check whether the next character is oid. Then
   check the refname.
2. If the next line starts with '^', it would continue to parse the
   peeled oid and check whether the last character is '\n'.

As we decide to implement the ref consistency check for "packed-refs",
let's port these two checks and update the test to exercise the code.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/fsck-msgids.txt
fsck.h
refs/packed-backend.c
t/t0602-reffiles-fsck.sh