Hi All: This version fixes two problems: 1. Remove unnecessary space. 2. Drop extra "strerror(errno)". Thanks, Jialuo shejialuo (9): ref: initialize "fsck_ref_report" with zero ref: check the full refname instead of basename ref: initialize ref name outside of check functions ref: support multiple worktrees check for refs ref: port git-fsck(1) regular refs check for files backend ref: add more strict checks for regular refs ref: add basic symref content check for files backend ref: check whether the target of the symref is a ref ref: add symlink ref content check for files backend Documentation/fsck-msgids.txt | 35 +++ builtin/refs.c | 10 +- fsck.h | 6 + refs.c | 7 +- refs.h | 3 +- refs/debug.c | 5 +- refs/files-backend.c | 194 +++++++++++- refs/packed-backend.c | 8 +- refs/refs-internal.h | 5 +- refs/reftable-backend.c | 3 +- t/t0602-reffiles-fsck.sh | 576 ++++++++++++++++++++++++++++++++-- 11 files changed, 790 insertions(+), 62 deletions(-) Range-diff against v8: 1: bfb2a21af4 = 1: bfb2a21af4 ref: initialize "fsck_ref_report" with zero 2: 9efc83f7ea = 2: 9efc83f7ea ref: check the full refname instead of basename 3: 5ea7d18203 = 3: 5ea7d18203 ref: initialize ref name outside of check functions 4: cb4669b64d = 4: cb4669b64d ref: support multiple worktrees check for refs 5: c6c128c922 ! 5: d6188063d9 ref: port git-fsck(1) regular refs check for files backend @@ refs/files-backend.c: typedef int (*files_fsck_refs_fn)(struct ref_store *ref_st + if (S_ISLNK(iter->st.st_mode)) + goto cleanup; + -+ if (strbuf_read_file(&ref_content, iter->path.buf, 0) < 0 ) { ++ if (strbuf_read_file(&ref_content, iter->path.buf, 0) < 0) { + /* + * Ref file could be removed by another concurrent process. We should + * ignore this error and continue to the next ref. @@ refs/files-backend.c: typedef int (*files_fsck_refs_fn)(struct ref_store *ref_st + if (errno == ENOENT) + goto cleanup; + -+ ret = error_errno(_("cannot read ref file '%s': %s"), -+ iter->path.buf, strerror(errno)); ++ ret = error_errno(_("cannot read ref file '%s'"), iter->path.buf); + goto cleanup; + } + 6: 911fa42717 = 6: e5e97ba3ad ref: add more strict checks for regular refs 7: 7aa6a99206 = 7: 1dec0a56d2 ref: add basic symref content check for files backend 8: dbb0787ad1 = 8: dcc4a02102 ref: check whether the target of the symref is a ref 9: a6d85b4864 ! 9: fc10862f6f ref: add symlink ref content check for files backend @@ refs/files-backend.c: static int files_fsck_refs_content(struct ref_store *ref_s goto cleanup; + } - if (strbuf_read_file(&ref_content, iter->path.buf, 0) < 0 ) { + if (strbuf_read_file(&ref_content, iter->path.buf, 0) < 0) { /* @@ refs/files-backend.c: static int files_fsck_refs_content(struct ref_store *ref_store, goto cleanup; -- 2.47.0