git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] fsck: ignore missing "refs" directory for linked worktrees

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 2, 2025, 01:33 UTC
Message-ID
<xmqqv7pfudux.fsf@gitster.g>
In-Reply-To
<3f731776-9a9e-4c8f-8de9-99d470503345@app.fastmail.com>
"Kristoffer Haugsbakk" <code@khaugsbakk.name> writes:
Show 8 quoted lines
> On Sat, May 31, 2025, at 05:39, shejialuo wrote:
>> It is reported that "git refs verify" would fail when encountering
>> worktrees created on Git v2.43.0 or older versions. These versions
>
> Nit: maybe
>
>     "git refs verify" doesn't work if there are worktrees created on Git
>     v2.43.0 ...
Yeah, "It is reported that" was somewhat odd introduction.
>> don't automatically create the "refs" directory, causing the error:
>>
>>     error: cannot open directory .git/worktrees/<worktree name>/refs:
>>     No such file or directory
The original of this part already reads quite well, I think.
Show 6 quoted lines
>> Since 8f4c00de95 (builtin/worktree: create refdb via ref backend,
>> 2024-01-08), we automatically create the "refs" directory for new
>> worktrees. However, the fsck code incorrectly assumes all linked
>> worktrees have this directory, thus introducing compatibility issue.
>
> Thanks for finding that commit.

Yup. And that one is v2.44.0-rc0~58^2, and that is where "v2.43" in the above description comes from.

Show 5 quoted lines
> At this point in the message it seems like the fsck code never worked
> with these old linked worktrees.  But `git refs verify` used to work
> with them until 7c78d819e6a (ref: support multiple worktrees check for
> refs, 2024-11-20) which was part of v2.48.0.  So I think it’s worth
> mentioning that commit as well.
Good suggestion.
Show 6 quoted lines
> Like I said in the first email the only minor regression in this release
> cycle is that git-fsck(1) reports these errors on stderr because the
> default `--reference`.  This was how I spotted the issue on rc0.  But I
> neglected to mention that the commit that introduced `--references`
> (default) for git-fsck(1) is v2.48.0-rc1-49-gc1cf918d3ad (builtin/fsck:
> add `git refs verify` child process, 2025-02-28).[1]

Thanks for a careful analysis. The "fix" is rather obvious, so let's see if we can come up with the final wording of the commit log message and merge it down in time ;-).

Previous: Kristoffer HaugsbakkNext: shejialuo
Message 7 of 21 in “[BUG] refs: verify does not work if there are v2.43.0 or older worktrees w/o wt. refs”
  1. kristofferhaugsbakk@fastmail.comMay 30, 2025
  2. Eric SunshineMay 30, 2025
  3. shejialuoMay 31, 2025
  4. Kristoffer HaugsbakkMay 31, 2025
  5. fsck: ignore missing "refs" directory for linked worktreesshejialuo, May 31, 2025
  6. Kristoffer HaugsbakkMay 31, 2025
  7. Junio C HamanoJun 2, 2025
  8. shejialuoJun 2, 2025
  9. Phillip WoodJun 2, 2025
  10. Patrick SteinhardtJun 2, 2025
  11. phillip.wood123@gmail.comJun 2, 2025
  12. Junio C HamanoJun 2, 2025
  13. shejialuoJun 2, 2025
  14. shejialuoJun 2, 2025
  15. 0/1 [BUG] refs: verify does not work if there are v2.43.0 or older worktrees w/o wt. refsshejialuo, Jun 2, 2025
  16. 1/1 fsck: ignore missing "refs" directory for linked worktreesshejialuo, Jun 2, 2025
  17. Kristoffer HaugsbakkJun 2, 2025
  18. shejialuoJun 2, 2025
  19. 0/1 [BUG] refs: verify does not work if there are v2.43.0 or older worktrees w/o wt. refsshejialuo, Jun 2, 2025
  20. 1/1 fsck: ignore missing "refs" directory for linked worktreesshejialuo, Jun 2, 2025
  21. Kristoffer HaugsbakkJun 2, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.