feat: wt delete takes more than one worktree - #6
Open
lorenzolfm wants to merge 1 commit into
Open
lorenzolfm wants to merge 1 commit into
lorenzolfm wants to merge 1 commit into
Conversation
A branch is rarely finished alone. Two reviews land in the same afternoon, and the tool asked for `wt delete` twice, each with its own git invocation and its own report. `wt delete eng-1234 eng-5678` removes both. The command reads every name before it removes anything. A name that is not a worktree stops it with the list of names, as it did before, and no worktree is gone by then. A list is something you type in one line and read back in one glance, so a typo in the second name is a list you did not mean to run; a partial removal would leave you to work out which half happened. The same read folds a repetition: a name and the path of the same worktree name one worktree, and the second `git worktree remove` of it would fail with a reason that says nothing about what you typed. A worktree that git refuses no longer stops the ones behind it. Git prints its own reason, wt collects the name, and the command reports each refusal in the message it fails with, so the exit code still says that the list did not run in full. The count at the end prints for a list only. One name gives one line, and that line is already the whole report; a list needs the count, because git writes its refusals between the lines of wt. `resolve` takes the worktrees and the names and returns the choice, so the order, the repetition and the unknown name are tests that need no repository. The fish completions need no change. They offer a worktree name after `delete` and after `d`, and fish offers them again at each position.
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.
wt delete eng-1234 eng-5678removes both. Two reviews land in the same afternoon, and the tool asked forwt deletetwice.The rules
git worktree removeof it would fail with a reason that says nothing.Notes
resolvetakes the worktrees and the names and returns the choice, so order, repetition and the unknown name are unit tests that need no repository. The fish completions need no change: they already offer a worktree name afterdeleteandd, at each position.Verified
In a scratch repository: an unknown name removes nothing (exit 1); two clean worktrees go together; a dirty worktree is kept while its clean neighbour is removed, with both reported (exit 1);
wt deletewith no argument is a clap usage error.cargo clippy --all-targets -- -D warningsis clean, 38 tests pass.