Git Worktree Add command error 129 when directory path contains spaces
When I attempt to add a new worktree using the TortoiseGit interface in a directory that contains a space in the path, the command fails with error 129, indicating that the command is malformed. The path appears to not be properly quoted by TortoiseGit. When I attempt to add quotes to the command in the input, I see a message that the special characters are not allowed. This message also asks if I want to proceed anyway, but does not actually give me a way to proceed.
What steps will reproduce the problem?
- Clone a Git repository to a directory that contains a space character in the path.
- From this repository, attempt to add a worktree in the same parent directory using the TortoiseGit interface.
What is the expected output? What do you see instead?
Expected: New worktree directory created and success message.
Instead, I get this error message:
git.exe worktree add -- C:\_Work\FortiGate CNF\Admin Guide\23.2 23.2
usage: git worktree add [<options>] <path> [<commit-ish>]
or: git worktree list [<options>]
or: git worktree lock [<options>] <path>
or: git worktree move <worktree> <new-path>
or: git worktree prune [<options>]
or: git worktree remove [<options>] <worktree>
or: git worktree repair [<path>...]
or: git worktree unlock <path>
-f, --force checkout <branch> even if already checked out in other worktree
-b <branch> create a new branch
-B <branch> create or reset a branch
-d, --detach detach HEAD at named commit
--checkout populate the new working tree
--lock keep the new working tree locked
--reason <string> reason for locking
-q, --quiet suppress progress reporting
--track set up tracking mode (see git-branch(1))
--guess-remote try to match the new branch name with a remote-tracking branch
git did not exit cleanly (exit code 129) (110 ms @ 6/1/2023 7:13:01 AM)
What version of TortoiseGit and Git are you using? On what operating system?
OS: Windows 10 Pro (version: 21H2; OS build: 19044.2965)
Same result using both TortoiseGit 2.14.1 and 2.14.0.