Bug: cleanup-worktrees.sh misses orphaned directories not registered with git #222
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/claude-custom#222
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Bug
Lineage
Repo
forgejo_admin/claude-custom
What Broke
cleanup-worktrees.shonly iteratesgit worktree list --porcelain. Orphaned directories (git lost registration, directory remains on disk) are invisible to the script. 37 of 64 pal-e-platform worktree dirs are orphans that never get cleaned up (~1.8GB disk waste across repos).Repro Steps
ls ~/pal-e-platform/.claude/worktrees/ | wc -l— shows 67 directoriesgit -C ~/pal-e-platform worktree list | wc -l— shows only 31 (git-tracked)Expected Behavior
Post-session cleanup should remove both git-tracked worktrees AND orphaned directories for merged/stale branches.
Environment
{repo}/.claude/worktrees/agent-*(Claude Code managed) and/tmp/{repo}-*(agent-created)Acceptance Criteria
Related