Subject: Re: [BUG] refs: verify does not work if there are v2.43.0 or older worktrees w/o wt. refs

From: shejialuo <[email-masked]>
Date: Sat, 31 May 2025 09:03:51 +0800

On Fri, May 30, 2025 at 06:23:25PM -0400, Eric Sunshine wrote:
> On Fri, May 30, 2025 at 3:00 PM <[email-masked]> wrote:
> > git-refs-verify(1) checks worktree refs since v2.47.0-111-g7c78d819e6a
> > (ref: support multiple worktrees check for refs, 2024-11-20).  This
> > causes the command to always exit with code `255` and stderr output
> > lines for each worktree created on v2.43.0 or older that does not have
> > worktree refs:
> >
> >     error: cannot open directory .git/worktrees/<worktree name>/refs: No such file or directory
> 
> Interesting. I didn't follow the topic which introduced 7c78d819e6
> (ref: support multiple worktrees check for refs, 2024-11-20), but I
> can confirm that this is a problem.
> 

Yes, I didn't realize about this. Thank Kristoffer for reporting this
issue and you for confirming this. I would write a patch today to fix
this issue. And hope that this fix would land in this release.

> > This is apparently caused by worktrees created on Git v2.43.0 or older.
> > Apparently these worktrees don’t have this directory unless there exist
> > worktree refs:
> >
> >     .git/worktrees/<worktree name>/refs
> 
> Indeed, the "refs" subdirectory was not present by default in older
> Git versions. Were you able to track down which commit is responsible
> for that directory getting created automatically when the worktree
> gets created?
> 

I find out that; in 8f4c00de95 (builtin/worktree: create refdb via ref
backend, 2024-01-08)