Repository navigation
fix(remove): don't point at a detached worktree removed in the same run - #4313
Merged
Merged
Conversation
`wt remove <branch> <its-detached-path>` removed the detached worktree and then told the user to remove that same directory, because the branch-only plan's annotation was computed before the other targets were known. Clear it when another plan in the run removes that path. Co-Authored-By: Claude <[email protected]>
1 task
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.
#3791 made a branch-only
wt removename the detached worktree still sitting at the branch's path, with a hint to runwt remove <that path>. When the user does that in the same command,wt remove feature ../repo.feature, the worktree removal runs first. The branch-only line then still reports the now-deleted directory and suggests removing it:--format=jsoncarries the same staledetached_worktreepath. The annotation is computed per target insidevalidate_remove_targets, before the other targets are known. This PR clears it after the loop when another plan in the same run (othersorcurrent) removes that path. The check runs after the loop because the path argument can come before or after the branch. A path target that failed validation isn't removed, so its hint stays.test_remove_branch_and_its_detached_worktree_togetherfails onmainwith the output above and passes with the fix. All 142remove::integration tests, including the new one, pass locally.