git/refs
shejialuo 784ceccb91 packed-backend: fsck should warn when "packed-refs" file is empty
We assume the "packed-refs" won't be empty and instead has at least one
line in it (even when there are no refs packed, there is the file header
line). Because there is no terminating LF in the empty file, we will
report "packedRefEntryNotTerminated(ERROR)" to the user.

However, the runtime code paths would accept an empty "packed-refs"
file, for example, "create_snapshot" would simply return the "snapshot"
without checking the content of "packed-refs". So, we should skip
checking the content of "packed-refs" when it is empty during fsck.

After 694b7a1999 (repack_without_ref(): write peeled refs in the
rewritten file, 2013-04-22), we would always write a header into the
"packed-refs" file. So, versions of Git that are not too ancient never
write such an empty "packed-refs" file.

As an empty file often indicates a sign of a filesystem-level issue, the
way we want to resolve this inconsistency is not make everybody totally
silent but notice and report the anomaly.

Let's create a "FSCK_INFO" message id "EMPTY_PACKED_REFS_FILE" to report
to the users that "packed-refs" is empty.

Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-05-14 12:32:58 -07:00
..
debug.c Merge branch 'ps/object-wo-the-repository' 2025-04-15 13:50:15 -07:00
files-backend.c Merge branch 'ps/object-file-cleanup' 2025-04-24 17:25:33 -07:00
iterator.c refs/iterator: implement seeking for merged iterators 2025-03-12 11:31:19 -07:00
packed-backend.c packed-backend: fsck should warn when "packed-refs" file is empty 2025-05-14 12:32:58 -07:00
packed-backend.h refs/files: use heuristic to decide whether to repack with `--auto` 2024-09-04 08:03:24 -07:00
ref-cache.c refs/iterator: implement seeking for ref-cache iterators 2025-03-12 11:31:20 -07:00
ref-cache.h refs: keep track of unresolved reference value in iterators 2024-08-09 08:47:33 -07:00
refs-internal.h refs: support rejection in batch updates during F/D checks 2025-04-08 07:57:21 -07:00
reftable-backend.c Merge branch 'kn/non-transactional-batch-updates' 2025-04-16 13:54:19 -07:00