git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Kristoffer Haugsbakk" <code@khaugsbakk.name>
Cc: shejialuo <shejialuo@gmail.com>,
	 git@vger.kernel.org,  "Patrick Steinhardt" <ps@pks.im>,
	 "Karthik Nayak" <karthik.188@gmail.com>,
	 "Eric Sunshine" <sunshine@sunshineco.com>
Subject: Re: [PATCH] fsck: ignore missing "refs" directory for linked worktrees
Date: Sun, 01 Jun 2025 18:33:10 -0700	[thread overview]
Message-ID: <xmqqv7pfudux.fsf@gitster.g> (raw)
In-Reply-To: <3f731776-9a9e-4c8f-8de9-99d470503345@app.fastmail.com> (Kristoffer Haugsbakk's message of "Sat, 31 May 2025 14:17:34 +0200")

"Kristoffer Haugsbakk" <code@khaugsbakk.name> writes:

> 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.

>> 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.

> 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.

> 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 ;-).


  reply	other threads:[~2025-06-02  1:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 19:00 [BUG] refs: verify does not work if there are v2.43.0 or older worktrees w/o wt. refs kristofferhaugsbakk
2025-05-30 22:23 ` Eric Sunshine
2025-05-31  1:03   ` shejialuo
2025-05-31  9:52   ` Kristoffer Haugsbakk
2025-05-31  3:39 ` [PATCH] fsck: ignore missing "refs" directory for linked worktrees shejialuo
2025-05-31 12:17   ` Kristoffer Haugsbakk
2025-06-02  1:33     ` Junio C Hamano [this message]
2025-06-02 11:30     ` shejialuo
2025-06-02  9:53   ` Phillip Wood
2025-06-02 10:24     ` Patrick Steinhardt
2025-06-02 13:50       ` phillip.wood123
2025-06-02 19:49       ` Junio C Hamano
2025-06-02 12:16     ` shejialuo
2025-06-02 12:41   ` shejialuo
2025-06-02 13:26   ` [PATCH v2 0/1] [BUG] refs: verify does not work if there are v2.43.0 or older worktrees w/o wt. refs shejialuo
2025-06-02 13:29     ` [PATCH v2 1/1] fsck: ignore missing "refs" directory for linked worktrees shejialuo
2025-06-02 13:59       ` Kristoffer Haugsbakk
2025-06-02 14:11         ` shejialuo
2025-06-02 14:40     ` [PATCH v3 0/1] [BUG] refs: verify does not work if there are v2.43.0 or older worktrees w/o wt. refs shejialuo
2025-06-02 14:41       ` [PATCH v3 1/1] fsck: ignore missing "refs" directory for linked worktrees shejialuo
2025-06-02 15:01       ` [PATCH v3 0/1] [BUG] refs: verify does not work if there are v2.43.0 or older worktrees w/o wt. refs Kristoffer Haugsbakk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqv7pfudux.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=code@khaugsbakk.name \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=ps@pks.im \
    --cc=shejialuo@gmail.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).