-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Problem
When a branch name contains # (e.g., feature/issue#123), the resulting worktree folder name also contains #. This breaks Python virtual environment scripts because the shebang line gets truncated.
Example
Branch: feature/issue#123
Folder: feature-issue#123
The shebang in .venv/bin/python:
#!/path/to/worktrees/feature-issue#123/.venv/bin/python
Shell interprets # as comment start, so it becomes:
#!/path/to/worktrees/feature-issue
This causes "command not found" errors when running any Python tool.
Environment
- OS: macOS
- Shell: zsh/bash
- Git version: 2.x
Proposed Solution
Add # to the character list in sanitize_branch_name() function in lib/core.sh:
- printf "%s" "$branch" | sed -e 's/[\/\\ :*?"<>|]/-/g' -e 's/^-*//' -e 's/-*$//'
+ printf "%s" "$branch" | sed -e 's/[\/\\ :*?"<>|#]/-/g' -e 's/^-*//' -e 's/-*$//'This converts feature/issue#123 to feature-issue-123.
Metadata
Metadata
Assignees
Labels
No labels