Track delimiter-safe parsing for worktree paths with spaces or parentheses
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 5.1k
- Forks
- 166
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 5
Description
Check list
- I have read through the README
- I have the latest version of forgit
- I have searched through the existing issues
Problem / Steps to reproduce
During review of #402, we noted that _forgit_extract_worktree_path() currently parses formatted worktree lines using cut -c6- | awk '{print $1}'.
This is not delimiter-safe and breaks for worktree paths that contain spaces or parentheses. As a result, worktree-related flows that depend on this parser can misbehave, including preview, yank, lock/unlock, delete, and jump/select operations.
This is being left as a TODO for now to keep #402 scoped and avoid making the parsing/display logic more complex in that PR.
A rough direction for a future fix would be to change the contract between _forgit_worktree_list() and _forgit_extract_worktree_path() so that the machine-readable path is emitted in a delimiter-safe form, for example by using a tab-delimited format and parsing it with cut -f1 or awk -F '\t'.
It would also be good to add regression tests that cover worktree paths containing spaces and parentheses.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with _forgit_worktree_list() and _forgit_extract_worktree_path(), then trace the preview, yank, lock/unlock, delete, and jump/select flows that consume the parsed path. Update the list-to-parser contract so paths remain delimiter-safe, add regression coverage for spaces and parentheses, and verify those worktree operations use the complete path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100