Subject: Re: [PATCH 07/17] refs/files: perform consistency checks for root refs

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 12 Jan 2026 09:17:35 +0100

On Sat, Jan 10, 2026 at 08:47:31PM +0800, shejialuo wrote:
> On Fri, Jan 09, 2026 at 01:39:36PM +0100, Patrick Steinhardt wrote:
> >  static int files_fsck(struct ref_store *ref_store,
> >  		      struct fsck_options *o,
> >  		      struct worktree *wt)
> >  {
> >  	struct files_ref_store *refs =
> >  		files_downcast(ref_store, REF_STORE_READ, "fsck");
> > +	struct files_fsck_root_ref_data data = {
> > +		.refs = refs,
> > +		.o = o,
> > +		.wt = wt,
> > +		.refname = STRBUF_INIT,
> > +		.path = STRBUF_INIT,
> > +	};
> >  	int ret = 0;
> >  
> >  	if (files_fsck_refs_dir(ref_store, o, wt) < 0)
> >  		ret = -1;
> > +
> > +	if (for_each_root_ref(refs, files_fsck_root_ref, &data) < 0 ||
> > +	    data.errors_found)
> 
> I am wondering where we update this filed in `files_fsck_root_ref`. It
> seems that we never do this in this commit. I think we should delete
> this filed in `files_fsck_root_ref_data` and add this field back when we
> do need this to avoid confusion.

Oh, you're right. I think I did use it in an earlier iteration, but
don't seem to do anymore. Will fix.

Patrick