From: Jeff King <peff@peff•net>
To: Patrick Steinhardt <ps@pks•im>
Cc: git@vger•kernel.org, Tian Yuchen <cat@malon•dev>
Subject: Re: [PATCH] read_gitfile_gently(): return non-repo path on error
Date: Thu, 4 Jun 2026 02:27:20 -0400 [thread overview]
Message-ID: <20260604062720.GA3195904@coredump.intra.peff.net> (raw)
In-Reply-To: <ah6WEtk2pXyViEQA@pks.im>
On Tue, Jun 02, 2026 at 10:36:34AM +0200, Patrick Steinhardt wrote:
> > The correct output (which this patch produces) is:
> >
> > fatal: not a git repository: /home/peff/compile/git/.git/worktrees/worktree3
> >
> > And indeed, that path is missing. But why? I feel like I've run into
> > this same problem occasionally over the last year or so, but never
> > before. Did we get more aggressive about removing worktrees at some
> > point? I haven't been able to reproduce whatever is killing off the
> > worktree directory, and by the time I see the error it is long gone.
>
> Both git-gc(1) and git-maintenance(1) prune orphaned worktrees that are
> older than three months by default, which can be configured via
> "gc.worktreePruneExpire". That logic has changed in 4dda60c9df (Merge
> branch 'ps/maintenance-missing-tasks', 2025-05-15), which would kind of
> match your timeline.
>
> But rereading that patch series I cannot really see how it could result
> in more aggressive pruning of worktrees. We used `git worktree prune
> --expire <expiry>` before that series, and we still use that logic now.
Yeah, but this .git/worktrees/ directory shouldn't be pruned _at all_.
The worktree itself is still there (which is why I'm getting the error).
So perhaps there's a bug in checking that things are still there, or
perhaps something is corrupting .git/worktrees/*/gitdir.
Another option is "I moved my git checkout and the worktree prune
couldn't find the directory as an absolute path", but I'm sure I didn't
do that.
An even more exotic option is that I run Git's test suite a lot, and
very occasionally bugs in the test suite cause the script to escape the
trash directory. And some scripts do run "rm -r .git/worktrees". I find
it pretty unlikely for that to be the culprit though.
Oh well. I don't have any good leads, so I guess I'll see if it happens
again. But maybe now if somebody else sees it we can commiserate. :)
-Peff
next prev parent reply other threads:[~2026-06-04 6:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 6:11 [PATCH] read_gitfile_gently(): return non-repo path on error Jeff King
2026-06-02 7:42 ` Junio C Hamano
2026-06-02 8:02 ` Jeff King
2026-06-02 8:36 ` Patrick Steinhardt
2026-06-04 6:27 ` Jeff King [this message]
2026-06-04 7:08 ` Patrick Steinhardt
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=20260604062720.GA3195904@coredump.intra.peff.net \
--to=peff@peff$(echo .)net \
--cc=cat@malon$(echo .)dev \
--cc=git@vger$(echo .)kernel.org \
--cc=ps@pks$(echo .)im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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