-
Notifications
You must be signed in to change notification settings - Fork 155
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.