You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Corrupt worktree dirs (not a git repository) are permanently uncollectable by GC #642
Live evidence (2026-08-21): worktrees/273cd72a-* fails git status with "fatal: not a git repository" — a damaged worktree dir whose thread is archived and past all grace periods.
Both GC paths permanently skip it:
gcScan marks it blocked: "git could not read the directory" (electron/worktrees.js:4151), and enforceRetention excludes blocked candidates (worktrees.js:4337), forever.
sweepOrphanWorktrees only touches dirs no thread references; this one has a (dead, archived) thread.
So a single interrupted git worktree add leaves a multi-hundred-MB dir that no automatic path can ever remove — the user must find and delete it by hand, and there is no UI surface that even shows it (the GC dialog filters to candidates, and this one is always blocked).
Fix direction: for a worktree dir whose owning thread is archived/transient AND whose .git is unreadable, offer force-removal (fs.rm of the directory + git worktree prune in the repo path) — the branch, if any survived, is untouched by directory removal. At minimum, surface blocked-forever entries in the GC dialog with a manual "Delete directory" action.
Implemented on coder/fork-corrupt-worktree-dirs-not-a-git-rep-ab2c6e.
A worktree git reports as fatal: not a git repository is no longer blocked-forever when the owner is an orphan or a transient (archived / fork):
gcScan marks it corrupt (not blocked)
enforceRetention / gcClean force-delete the directory (fs.rm + git worktree prune) and clear the thread pointer
sweepOrphanWorktrees does the same for unreferenced dirs
the branch is left alone
Settings → Worktrees pre-selects the row and shows “git could not read the directory · force-delete”
Still blocked (intentional): dirty trees, other git failures (lock / timeout / missing binary), and corrupt settled keep-N overflow — those are not archived/transient.
Other git failures stay blocked so a missing git on PATH cannot mass-delete archived checkouts.
Activity
currentbits commentedon Aug 21, 2026
Implemented on
coder/fork-corrupt-worktree-dirs-not-a-git-rep-ab2c6e.A worktree git reports as
fatal: not a git repositoryis no longer blocked-forever when the owner is an orphan or a transient (archived / fork):gcScanmarks itcorrupt(notblocked)enforceRetention/gcCleanforce-delete the directory (fs.rm+git worktree prune) and clear the thread pointersweepOrphanWorktreesdoes the same for unreferenced dirsStill blocked (intentional): dirty trees, other git failures (lock / timeout / missing binary), and corrupt settled keep-N overflow — those are not archived/transient.
Other git failures stay blocked so a missing
giton PATH cannot mass-delete archived checkouts.