Subject: Re: [PATCH 10/17] refs/files: introduce function to perform normal ref checks

From: shejialuo <[email-masked]>
Date: Sat, 10 Jan 2026 21:12:15 +0800

On Fri, Jan 09, 2026 at 01:39:39PM +0100, Patrick Steinhardt wrote:
> In a subsequent commit we'll introduce new generic checks for direct
> refs. These checks will be independent of the actual backend.
> 
> Introduce a new function `refs_fsck_ref()` that will be used for this
> purpose. At the current point in time it's still empty, but it will get
> populated in a subsequent commit.
> 
> Signed-off-by: Patrick Steinhardt <[email-masked]>
> ---
>  refs.c               | 7 +++++++
>  refs.h               | 8 ++++++++
>  refs/files-backend.c | 2 ++
>  3 files changed, 17 insertions(+)
> 
> diff --git a/refs.c b/refs.c
> index 739bf9fefc..4fc1317cb3 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -320,6 +320,13 @@ int check_refname_format(const char *refname, int flags)
>  	return check_or_sanitize_refname(refname, flags, NULL);
>  }
>  
> +int refs_fsck_ref(struct ref_store *refs UNUSED, struct fsck_options *o UNUSED,
> +		  struct fsck_ref_report *report UNUSED,
> +		  const char *refname UNUSED, const struct object_id *oid UNUSED)
> +{
> +	return 0;
> +}
> +
>  int refs_fsck_symref(struct ref_store *refs UNUSED, struct fsck_options *o,
>  		     struct fsck_ref_report *report,
>  		     const char *refname UNUSED, const char *target)
> diff --git a/refs.h b/refs.h
> index d91fcb2d2f..61c56cca36 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -655,6 +655,14 @@ int check_refname_format(const char *refname, int flags);
>  
>  struct fsck_ref_report;
>  
> +/*
> + * Perform generic checks for a specific symref target. This function is
> + * expected to be called by the ref backends for every symbolic ref.
> + */

I think above comment is the same as `refs_fsck_symref`, I think we
should update to say that we perform generic checks for a ref instead of
a specific symref target.

Thanks,
Jialuo