feat: support existing branches when adding worktrees#37
Open
nelson870708 wants to merge 1 commit into
Open
Conversation
Filter out branches already checked out in worktrees and default new worktree paths beside the main worktree.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Pull Request
1. Summary
Support creating worktrees from existing branches in addition to creating a new branch. The add-worktree modal now separates existing-branch and new-branch flows, filters out branches already checked out in worktrees, and uses cleaner default worktree paths based on the main worktree.
2. Related Issue
3. Changes
Extension (
src/)src/extension.ts<main-repo>.worktrees.src/__tests__/extension.test.tsWebview (
webview-ui/)webview-ui/src/components/modals/AddWorktreeModal.svelteStart atand branch name fields only in new-branch mode.webview-ui/src/components/modals/__tests__/AddWorktreeModal.test.tswebview-ui/src/lib/i18n/en.tswebview-ui/src/lib/i18n/ko.tswebview-ui/src/lib/i18n/zh.tsOther (build, config, docs, etc.)
4. Type of Change
Check all that apply.
5. Testing
Describe how you verified the changes.
npm testpassednpm run lintpassed6. Screenshots (optional)
Before change
After change
7. Checklist
message-bus.ts(if applicable)en.tsandko.ts(if applicable)l10n/bundle.l10n.jsonandbundle.l10n.ko.json(if applicable)console.logor debug code8. Additional Context (optional)
The existing-branch option intentionally excludes branches already checked out in worktrees because Git does not allow the same branch to be checked out in multiple worktrees.