summaryrefslogtreecommitdiffstats
path: root/refs.c
diff options
context:
space:
mode:
authorshejialuo <shejialuo@gmail.com>2024-11-20 12:51:42 +0100
committerJunio C Hamano <gitster@pobox.com>2024-11-21 00:21:32 +0100
commit824aa541aae7a35f32f9dabc54f8a97861488013 (patch)
tree9327d43ff3df5f7b6535843724a19665d017f6a2 /refs.c
parentref: support multiple worktrees check for refs (diff)
downloadgit-824aa541aae7a35f32f9dabc54f8a97861488013.tar.xz
git-824aa541aae7a35f32f9dabc54f8a97861488013.zip
ref: port git-fsck(1) regular refs check for files backend
"git-fsck(1)" implicitly checks the ref content by passing the callback "fsck_handle_ref" to the "refs.c::refs_for_each_rawref". Then, it will check whether the ref content (eventually "oid") is valid. If not, it will report the following error to the user. error: refs/heads/main: invalid sha1 pointer 0000... And it will also report above errors when there are dangling symrefs in the repository wrongly. This does not align with the behavior of the "git symbolic-ref" command which allows users to create dangling symrefs. As we have already introduced the "git refs verify" command, we'd better check the ref content explicitly in the "git refs verify" command thus later we could remove these checks in "git-fsck(1)" and launch a subprocess to call "git refs verify" in "git-fsck(1)" to make the "git-fsck(1)" more clean. Following what "git-fsck(1)" does, add a similar check to "git refs verify". Then add a new fsck error message "badRefContent(ERROR)" to represent that a ref has an invalid content. 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>
Diffstat (limited to 'refs.c')
0 files changed, 0 insertions, 0 deletions