Skip to content

feat: prune across all linked projects using remote refs#17

Merged
Naoray merged 2 commits into
mainfrom
feat/prune-all-linked-projects
Mar 19, 2026
Merged

feat: prune across all linked projects using remote refs#17
Naoray merged 2 commits into
mainfrom
feat/prune-all-linked-projects

Conversation

@Naoray

@Naoray Naoray commented Mar 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • anvil prune now iterates every project in the global config instead of requiring CWD to be inside a linked repo — makes it useful as a global housekeeping command
  • Merge detection now fetches origin first and compares against origin/<default-branch>, preventing false negatives from stale local refs
  • Extracted pruneProject() helper for single-project logic; RunE becomes a thin loop over projects

Test Plan

  • go test ./internal/git/...TestFetchOrigin_Success, TestFetchOrigin_NoRemote, TestIsMerged_AgainstRemoteRef
  • go test ./internal/cli/...TestPruneProject_RemovesMergedWorktree, TestPruneProject_KeepsUnmergedWorktree, TestPruneProject_DryRunDoesNotRemove
  • Run anvil prune from outside a linked project directory — should process all linked projects
  • Run anvil prune --dry-run — should list merged worktrees without removing them

🤖 Generated with Claude Code

Naoray and others added 2 commits March 19, 2026 14:03
- `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>
@Naoray Naoray merged commit 387f862 into main Mar 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant