Search code examples
gitvisual-studio-code

VS Code not showing changes and staged files showing as blank


At some point my VS Code started having an issue where viewing the changes shows the previous version as blank - like you would see if it were a new untracked file. This has always shown the correct information previously. If I run git diff <filename> then it shows the correct data, but VS Code shows it as:

VS Code changes are blank for previous versions

Along with that, when I stage the change(s) and then click on the file to view the changes, then nothing shows up on either pane:

VS Code changes are blank for both the current and previous versions

To the best of my knowledge I haven't changed a single thing (except some Windows updates) to my computer.

The only thing that I have done recently was to install Ruby and another Git addon for that, but this was much more recent than these problems.

I've tried:

  • Disabling & reenabling the built-in Git extensions
  • Opening files from both a mapped (S:) drive and the UNC path
  • Disabling/removing/reinstalling all extensions
  • Creating new files & directories
  • Checking/unchecking diff & SCM settings
  • Uninstalled & reinstalled VS Code and all other folders that don't get deleted after uninstallation per How to uninstall VS Code completely

I don't have access to another repository otherwise I would try that next. I am utterly stumped and appreciate any help you might have. Thanks in advance.

Edit: I created a new local admin account on my computer with just my Microsoft login (as opposed to our domain credentials) and then cloned a repository from GitHub. It is showing all of the changes and behaving as expected. So I'm unsure if this is an issue with my user account now or with the repository. I'd appreciate any suggestions on what else I can try!

Edit: I have created a new repository locally, on a mapped network drive, and also via UNC directly and all of that works just fine (from my domain-logged-in account). It seems to be an issue with the repo directly at this point as far as I can tell.


Solution

  • This should be fixed with VSCode 1.70 (July 2022), and issue 142842, fixed by PR 154342.

    // On Windows, there are cases in which the normalized path for a mapped folder contains a trailing `\`
    // character (ex: \\server\folder\) due to the implementation of `path.normalize()`. This behaviour is
    // by design as documented in https://github.com/nodejs/node/issues/1765.
    

    The fix references "Windows: fs.realpathSync() adds trailing slash for windows share".

    This is released in VSCode insider today.