Re: [PATCH v3 2/4] ref: add regular ref content check for files backend
- From
shejialuo <shejialuo@gmail.com>
- Date
- Sep 13, 2024, 10:25 UTC
- Message-ID
- <ZuQTApWlM8jOt9Ev@ArchLinux>
- In-Reply-To
- <CAOLa=ZT8N7TRSVNhqGrjskMTTFgO16Q4VKMVM1LPHtEorkT6cg@mail.gmail.com>
On Tue, Sep 10, 2024 at 09:07:15AM -0700, karthik nayak wrote:
[snip]
Show 25 quoted lines
> > +static int files_fsck_refs_content(struct ref_store *ref_store,
> > + struct fsck_options *o,
> > + const char *refs_check_dir,
> > + struct dir_iterator *iter)
> > +{
> > + struct strbuf ref_content = STRBUF_INIT;
> > + struct strbuf referent = STRBUF_INIT;
> > + struct strbuf refname = STRBUF_INIT;
> > + struct fsck_ref_report report = {0};
> > + const char *trailing = NULL;
> > + unsigned int type = 0;
> > + int failure_errno = 0;
> > + struct object_id oid;
> > + int ret = 0;
> > +
> > + strbuf_addf(&refname, "%s/%s", refs_check_dir, iter->relative_path);
> > + report.path = refname.buf;
> > +
> > + if (S_ISLNK(iter->st.st_mode))
> > + goto cleanup;
>
> Since we iterate over all refs, we don't need to check the target for a
> symbolic link. So we skip all symbolic links. Makes sense. Would be nice
> to have a comment here.
> Today I am handling the reviews, there is a misunderstanding here. It's correct that "We don't need to check the target for a symbolic link". But we do need to check the symbolic links. It might be a symlink symref. In here, we just ignore the implementation and will be implemented in the later patch.