git/refs
Karthik Nayak e0fcba2d9c refs/files: skip lock files during consistency checks
Consistency checks in the files reference backend involve two steps:

1. Iterate over all entries within the 'refs/' directory and call
`files_fsck_ref()` on each.
2. Iterate over all root refs via `for_each_root_ref()` and call
`files_fsck_ref()` on each.

`files_fsck_ref()` then runs all fsck checks defined in
`fsck_refs_fn[]`. Step 2 goes through the refs API and only sees valid
refs, but step 1 iterates the directory directly and may also encounter
intermediate '*.lock' files.

Currently, `files_fsck_refs_name()`, one of the functions in
`fsck_refs_fn[]`, filters out lock files itself. The other function,
`files_fsck_refs_content()`, has no such check and would parse the lock
file. Any new function added to `fsck_refs_fn[]` would have the same
problem.

Move the filter up into `files_fsck_refs_dir()`, where the directory
iteration happens. Since step 2 cannot produce lock files, this is the
only site where the filter is needed, and individual checks no longer
have to re-implement it.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-05-18 08:43:32 +09:00
..
debug.c Merge branch 'gf/maintenance-is-needed-fix' 2025-12-30 12:58:20 +09:00
files-backend.c refs/files: skip lock files during consistency checks 2026-05-18 08:43:32 +09:00
iterator.c refs: rename `each_ref_fn` 2026-02-23 13:21:18 -08:00
packed-backend.c Merge branch 'ps/refs-for-each' 2026-03-09 14:36:55 -07:00
packed-backend.h refs: receive and use the reference storage payload 2026-02-25 09:27:12 -08:00
ref-cache.c refs: drop infrastructure to peel via iterators 2025-11-04 07:32:25 -08:00
ref-cache.h ref-cache: remove unused function 'find_ref_entry()' 2025-07-15 11:54:19 -07:00
refs-internal.h Merge branch 'kn/ref-location' 2026-03-04 10:52:59 -08:00
reftable-backend.c reftable/stack: provide fsync(3p) via system header 2026-04-02 10:45:43 -07:00