]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/fsck: add `git refs verify` child process
authorshejialuo <shejialuo@gmail.com>
Thu, 27 Feb 2025 16:07:48 +0000 (00:07 +0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Feb 2025 22:03:10 +0000 (14:03 -0800)
commitc1cf918d3adbe832fdaf278a23151502be255bb2
treee800163941e13b1f49a3ef7b0a3d19103a4874b9
parente1c9548eae406a7aa7274685f8bdbc353827bf16
builtin/fsck: add `git refs verify` child process

At now, we have already implemented the ref consistency checks for both
"files-backend" and "packed-backend". Although we would check some
redundant things, it won't cause trouble. So, let's integrate it into
the "git-fsck(1)" command to get feedback from the users. And also by
calling "git refs verify" in "git-fsck(1)", we make sure that the new
added checks don't break.

Introduce a new function "fsck_refs" that initializes and runs a child
process to execute the "git refs verify" command. In order to provide
the user interface create a progress which makes the total task be 1.
It's hard to know how many loose refs we will check now. We might
improve this later.

Then, introduce the option to allow the user to disable checking ref
database consistency. Put this function in the very first execution
sequence of "git-fsck(1)" due to that we don't want the existing code of
"git-fsck(1)" which would implicitly check the consistency of refs to
die the program.

Last, 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/git-fsck.txt
builtin/fsck.c
t/t0602-reffiles-fsck.sh