Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worktrees fail to load in working path with spaces #1864

Closed
Koolstr opened this issue Mar 1, 2022 · 2 comments
Closed

Worktrees fail to load in working path with spaces #1864

Koolstr opened this issue Mar 1, 2022 · 2 comments
Assignees
Labels
bug Something isn't working needs-verification Request for community verification
Milestone

Comments

@Koolstr
Copy link

Koolstr commented Mar 1, 2022

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
@Koolstr Koolstr added potential-bug triage Needs to be looked at labels Mar 1, 2022
@eamodio eamodio added bug Something isn't working and removed potential-bug triage Needs to be looked at labels Mar 2, 2022
@eamodio eamodio self-assigned this Mar 2, 2022
@eamodio eamodio added this to the Soon™ milestone Mar 2, 2022
@vassyz
Copy link

vassyz commented Mar 5, 2022

How can I checkout that branch? I'm getting an error that the branch is already checked in in the worktree folder but I can't switch the worktree because of this bug.

@eamodio eamodio added pending-release Resolved but not yet released to the stable edition needs-verification Request for community verification and removed pending-release Resolved but not yet released to the stable edition labels Mar 15, 2022
@eamodio eamodio modified the milestones: Soon™, Shipped Mar 17, 2022
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working needs-verification Request for community verification
Projects
None yet
Development

No branches or pull requests

3 participants