feat: prune across all linked projects using remote refs#17
Merged
Conversation
- `anvil prune` now iterates every project in global config instead of requiring CWD to be inside a linked repo - Merge detection compares against `origin/<default-branch>` after fetching, so stale local refs no longer produce false negatives - Extracted `pruneProject()` helper for single-project logic - Added `git.FetchOrigin()` with tests for success and missing-remote - Added `TestIsMerged_AgainstRemoteRef` and CLI-level prune tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
anvil prunenow iterates every project in the global config instead of requiring CWD to be inside a linked repo — makes it useful as a global housekeeping commandoriginfirst and compares againstorigin/<default-branch>, preventing false negatives from stale local refspruneProject()helper for single-project logic;RunEbecomes a thin loop over projectsTest Plan
go test ./internal/git/...—TestFetchOrigin_Success,TestFetchOrigin_NoRemote,TestIsMerged_AgainstRemoteRefgo test ./internal/cli/...—TestPruneProject_RemovesMergedWorktree,TestPruneProject_KeepsUnmergedWorktree,TestPruneProject_DryRunDoesNotRemoveanvil prunefrom outside a linked project directory — should process all linked projectsanvil prune --dry-run— should list merged worktrees without removing them🤖 Generated with Claude Code