Fix pm rm leaking worktree dirs on slot release#815
Closed
claude[bot] wants to merge 1 commit into
Closed
Conversation
Wire the previously-dead remove_slot_worktree helper into the shared pool::release_project path so releasing a project's slots removes the worktree from disk and from git's worktree metadata, not just from pm state. Removal is best-effort so a manually-deleted slot doesn't make pm rm error; slot.branch is now cleared alongside slot.owner. Removed two now-unnecessary #[allow(dead_code)] markers.
Author
|
Superseded by #816 — same fix, recreated on a new branch with the DCO sign-off in place (avoids a force-push to rewrite history). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Bradley Axen · Slack thread
Before / After (plain language, what a user sees): Before, running
pm rm <project>removed the project from pm's state but left the git worktree directory under.pm/pool/repo--Non disk (and a dangling entry ingit worktree list), so stale worktrees accumulated over time. After,pm rm(and the stale-state cleanup paths inpm new/pm status) fully remove the worktree from disk and from git's worktree metadata.How: Wire up the previously-dead
remove_slot_worktreehelper into the sharedpool::release_projectpath. It runsgit worktree remove --force(falling back togit worktree prune) against the repo's bare clone, then force-removes the dir if git left it behind. Removal is best-effort so a manually-deleted slot doesn't makepm rmerror;slot.branchis now cleared alongsideslot.owner. Removed two#[allow(dead_code)]markers (pool.rs,git.rs).pm cleanupis read-only and inherits the fix transitively. Note: there is no existing test covering the pool-release path; verified viacargo test(workspace green) plus a manual smoke test (add → rm leaves the pool dir empty andgit worktree listclean; a pre-deleted slot exits 0).Generated by Claude Code