-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
If there is a space in a folder within the current working directory, the Worktrees feature fails to list out the existing worktrees, rendering the feature useless.
For example, within the following directory: /Users/koolstr/Documents/Projects/Example Project/example-project
The following errors are produced:
[2022-03-01 22:35:31.483] [GIT ] [/Users/koolstr/Documents/Projects/Example Project/example-project] git worktree list --porcelain • 32 ms
[2022-03-01 22:35:31.497] [GIT ] [/Users/koolstr/Documents/Projects/Example] git status --porcelain=v2 --branch -u --find-renames -- • The value of "err" is out of range. It must be a negative integer. Received 1 • 7 ms
[2022-03-01 22:35:31.497] [ 1147] LocalGitProvider.getStatusForRepo — failed • 9 ms
RangeError [ERR_OUT_OF_RANGE]: The value of "err" is out of range. It must be a negative integer. Received 1 (This error gets shown as a notification within the VS Code UI)
As you can see, the actual working path is cut off by the positional parameters sent from the git worktree list command, which delimit the path by spaces into separate parameters. The git status call only operates on that first positional parameter as the working path, which is an incorrect partial path.
To fix this, you can make an equivalent of this patch I recently made for this exact issue in another project.
- GitLens Version: 12.0.0
- Git Version: 2.33.1
- VSCode Version: 1.64.2
- OS Version: macOS Catalina 10.15.7