fix: resolve worktree paths with slashes in remove/destroy#12
Merged
ahmedelgabri merged 2 commits intomainfrom Feb 17, 2026
Merged
fix: resolve worktree paths with slashes in remove/destroy#12ahmedelgabri merged 2 commits intomainfrom
ahmedelgabri merged 2 commits intomainfrom
Conversation
Set TERM=dumb for treefmt to prevent termenv color detection queries from leaking into hook output.
When worktrees are created with slash-containing paths (e.g., feature/my-thing), `git wt remove` and `git wt destroy` failed to find them because resolve_worktree_path() only matched by basename (last path component). Running from a different worktree made realpath resolution fail too. Add a relative-to-bare-root matching strategy that joins the bare root with the user input and checks against cached paths. Also fix validate_worktree to show paths relative to the bare root instead of just basenames, so nested worktrees are identifiable in error messages. Closes #11
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.
Fixes #11
git wt removeandgit wt destroyfailed to find worktrees created at slash-containing paths (e.g.,feature/my-thing) when running from a different worktreeresolve_worktree_path()that joins the bare root with user input to match against cached pathsvalidate_worktree()error message to show paths relative to the bare root instead of just basenames (sofeature/nestedshows instead ofnested)