vscode-git-tree-compare
vscode-git-tree-compare copied to clipboard
Windows: Launching via `code` with different folder casing causes "Could not find any workspace folder for ..."
This may or may not happen for different sessions inside the same repository.
The tree is empty, shows GIT TREE COMPARE: NONE
.
When refreshing inside a repository the following can be seen in output tab:
Using git from C:\Program Files\Git\cmd\git.exe
Ignoring irrelevant change: c:\repos\REPO\.git\objects
Ignoring irrelevant change: c:\repos\repo\.git\logs\refs\remotes\origin\main
Ignoring irrelevant change: c:\repos\repo\.git\FETCH_HEAD
Updating the git tree failed: The "path" argument must be of type string. Received undefined
Finally figured out why this happens!
Turns out Git Tree Compare is case-sensitive on Windows.
The repository is in c:\repos\REPO.
If I launch with code c:\repos\REPO
, it works.
When I launch with code c:\repos\repo
, it doesn't.
If this can't be worked around, perhaps the error message could hint to this behaviour?
I can reproduce this when launching with a casing that doesn't match the actual casing on Windows. The first error I get is "Changing the repository failed: Could not find any workspace folder for c:...". Pressing the refresh button it then outputs "Updating the git tree failed: The "path" argument must be of type string. Received undefined" as in your case.
I'll have a look what the best way is to fix this but it's definitely an edge case. The tricky part is that Linux is case-sensitive, so two folders foo
and FOO
can actually co-exist, even though it's unusual.
For me it would be enough that the error hinted at the possibility the error may be caused by incorrect casing in path.
This also happens when using VsCode from Windows to remote Linux repo now ... this used to work, but has recently broken.
In Output I see:
Updating the git tree failed: The "path" argument must be of type string. Received undefined