Closed ghylander closed 2 years ago
Example here:
I did try to disable GitLens and reloading the window, but the issue persists
@ghylander, are you able to reproduce the issue outside of WSL? Which command are using to open the diff editor?
I did some testing and the problem seems to be, when in a WSL window, using git repositories in the windows filesystem. My tests:
I am using VS Code's own diff editor, just opening the diffs by clicking on items under the "Changes" list in the Source Control side-tab:
- Open the same repo folder from a WSL window and from a "normal" window. Issue happens in the WSL window with all repositories I tried
I would like to clarify, I tried this with multiple repos and all had the exact same issue
@ghylander, thanks for the additional information. Will try to get an in-house repro and will update the issue with my findings.
just checking the status of this
were you able to reproduce it?
@ghylander, apologies for not getting back to you on this. Yes, I was able to reproduce the issue and will be investigating it.
VS Code uses the output of git status
to render the list of files that are modified. In this particular scenario you will notice that running git status
on the Windows side (ex: using PowerShell) will show that there are not change, while running git status
in WSL will report that all files have changes. This is related to the different line endings in Windows/Linux, and the issue is described in this StackOverflow thread. I was able to solve the problem as described on the thread using the core.autocrlf
configuration.
Another thing to keep in mind is that if you would like to get the optimal performance, we recommend against working across operating systems with your files (ex: if you would like to use WSL, it is recommended that you clone your files to the Linux file system).
well, that was quite unexpected thank you very much for your findings, while i don't see any "fix" to this in VS, maybe you could include this in the workspace warning
Leaving this issue with line endings aside, what is the real impact of working on the "mounted" c drive? I know it is recommended to work inside the WSL filesystem, but is it really impactful? I can't say i notice any slow down when working with files stored under /mnt/c/
@ghylander, could you please elaborate on what you mean by workspace warning? Also, @aeschli, would it make sense for the WSL extension to show a warning when files are being opened from the Windows file system (ex: /mnt/c) as that could cause issues related to the file endings?
I believe that the performance degradation when working with files from the Windows file system was quite noticeable in WSL1 but things got much better in WSL2. I can only defer to the documentation that I have shared above as that has been authored and maintained by the WSL team.
@ghylander, could you please elaborate on what you mean by workspace warning?
I simply meant this warning: it's shown whenever you open a windows files system folder in a VSC WSL window. What I meant is that you could expand this warning with a information regarding issues with git (something like this seems to be what you are talking about when you quoted aschli)
thanks for the docs
I have a similar issue. I clone a git repo in wsl (in my home dir, so in the Linux file system), enter the dir, type code .
and vscode immediately suggests many (but not all) files have been changed. Inside wsl (Ubuntu 20.04) git status
does not list any changes.
I'm having this same issue on MacOS Monterey 12.3
I had the same issues in WSL and Windows. When I opened VSCode via WSL and opened a fresh cloned repo, it showed some files as modfied. When I opened it in Windows environment, everything was correct. Also GitKraken showed it correctly. I found the solution here:
https://github.com/microsoft/vscode/issues/137442
Quote: "This could have something to do with WSL reporting the permissions of all files on the Windows filesystem as being 777. Git then regards all files as changed because their permissions are different."
# For the current repository
git config core.filemode false
# Globally
git config --global core.filemode false
Also: "It may be line endings,WSL thinks it is linux so it will use LF as the line endings. You can set git to only use CRLF line endings with:"
git config --global core.autocrlf true
@lszomoru should I close the issue or keep it open? There are 3 'fixes':
Should the issue be kept open to redirect other issues that might pop up? Should it be closed, as I doubt anything will be done on VSC's side?
@ghylander, thank you for the nudge. I believe that your summary above seems accurate and as you have stated these are known issues that we can't do much within VS Code. I suggest that we close this issue for now and I will make sure to point future issues to it. Thank you!
Issue Type: Bug
I've checked with multiple git clients and with git CLI, and there are no changes between local branches and the origin head.
if i open the diff from within VS, there are no differencs between THEIRS and OURS. The file does say "You, seconds ago · Uncomitted changes" no matter when i open the diff, so it really looks like a bug on VSC.
This happens when in a WSL window, and the git dir is located on the windows filesystem (unsure if it's relevant)
VS Code version: Code - Insiders 1.63.0-insider (bedf867b5b02c1c800fbaf4d6ce09cefbafa1592, 2021-11-18T05:14:59.750Z) OS version: Windows_NT x64 10.0.19043 Restricted Mode: No Remote OS version: Linux arm64 4.9.140-tegra Remote OS version: Linux x64 4.19.128-microsoft-standard
System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz (8 x 1190)| |GPU Status|2d_canvas: enabledgpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|11.70GB (2.77GB free)| |Process Argv|--crash-reporter-id 4285aea8-8024-49ba-97f2-9d60622a70f0| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|SSH: Jetson_remote_cognitive| |OS|Linux arm64 4.9.140-tegra| |CPUs|unknown (4 x 1479)| |Memory (System)|3.87GB (0.76GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-18.04| |OS|Linux x64 4.19.128-microsoft-standard| |CPUs|Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz (8 x 1190)| |Memory (System)|9.10GB (7.28GB free)| |VM|0%|
Extensions (12)
Extension|Author (truncated)|Version ---|---|--- jupyter-keymap|ms-|1.0.0 remote-containers|ms-|0.206.0 remote-ssh|ms-|0.66.1 remote-ssh-edit|ms-|0.66.1 remote-wsl|ms-|0.63.2 vscode-remote-extensionpack|ms-|0.21.0 gitlens|eam|11.6.1 python|ms-|2021.11.1422169775 vscode-pylance|ms-|2021.11.2 jupyter|ms-|2021.11.1001475629 jupyter-keymap|ms-|1.0.0 jupyter-renderers|ms-|1.0.3 (2 theme extensions excluded)A/B Experiments
``` vsliv695:30137379 vsins829:30139715 vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythontb:30258533 pythonptprofiler:30281269 vsdfh931:30280409 vshan820:30294714 pythondataviewer:30285072 vscod805cf:30301675 pythonvspyt200:30323110 bridge0708:30335490 bridge0723:30353136 pythonrunftest32:30365365 pythonf5test824:30361779 javagetstartedt:30350119 pythonvspyt187:30365360 vsaa593cf:30376535 vsc1dst:30396469 vscexrecpromptt2:30397559 ```