Code change:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --<!-- Test using the latest Insiders build to see if your issue has already been fixed: --<!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes/No <!-- If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. --<!-- Issues caused by an extension need to be reported directly to the extension publisher. The 'Help Report Issue' dialog can assist with this. --- VS Code Version: 1.64.2 OS Version: Windows 10 Steps to Reproduce: a git repo in root of a drive (network share in my case) a change of a file to Source control a see file diff version is shown as empty command line shows diffs properly when git repo is located in some subfolder git diff works in VSCode properly
VS Code Version: 1.67.2 OS Version: Windows 10 () I am also receiving this error, and I have pinpointed it in the Git Output, hopefully, it helps the path is missing the first character in the path for a specific file on the 'git show --textconv' lines 'ub-folder' vs 'sub-folder' If the command is run manually, with the correct path there are no issues Working (Non-root folder) [2022-06-01T06:49:42.910Z] git ls-tree -l HEAD -- fserverc$gitsharesub-folderMapper [229ms] [2022-06-01T06:49:42.991Z] git show --textconv HEAD:sub- [318ms] Not Working (Root folder) [2022-06-01T06:51:54.868Z] git ls-tree -l HEAD -- fservergitsharesub-folderMapper [226ms] [2022-06-01T06:51:54.897Z] git show --textconv HEAD:ub- [262ms]
The issue is in the file The following Line needs to be changed to As the current process is removing a specific length, when sometimes the variable for 'to' can contain a single slash or double slash (which the + 1 would handle the double slash) I recommend using the regex to effectively trim any leading slashes rather than a calculated length. I have a working file here I can provide further details if required as well.
thank you very much for looking into this. I have looked at this today and while adopting a regex to remove the characters from the resulting path will work, I think that there is something else happening here that I would like to understand before making a fix. Debugging the issue I have noticed that when you open a folder from the root as described in this issue, the value of the parameter contains a trailing . This is why adding +1 to it, will actually remove an unwanted character. I will investigate this further and will get a fix in this week.
Quick update on this issue. While the method can be improved, the root cause of the problem here is that returns a path that has a trailing character. This then results in the repository root being incorrect which can result in unexpected behaviour, diff editor not working being one example. This method already has code to handle mapped drives but it does not seem to handle this particular scenario. As we are in the process of shutting down for the next Stable release, I will be looking at fixing this issue sometimes next week. I will update the issue when the fix will be released in Insiders. Thanks for your patience.
I believe I have tracked down the root cause of the issue to the call: Running the following tests clearly illustrate the problem. Notice that the second call contains a trailing . This particular behavior seems to be by design based on an old issue that I have found - One option that I have considered was to remove the trailing slash from the repository root but that does not seem to be a good option as there are Windows path that are only valid if they contain a trailing slash (ex: ). I am more inclined to tweak the implementation of to always use as that seems to be able to correctly handle directory paths with the trailing . what are your thoughts? Thanks!
Hi, I'm also having this issue, even on the insiders build. I disabled all installed extensions. Expected Git Output: Actual Git Output: The drive in question is a mapped network drive. Whenever I try to view the file diff, the previous file is blank. This problem applies to all files on the network drive, even ones in subdirectories. Let me know if there's any other information I should provide.
I have file to track the problem that you have reported.
<!-- AUTHORVERIFICATIONREQUEST --This bug has been fixed in the latest release of ! you can help us out by commenting if things are now working as expected. If things still don't seem right, please ensure you're on version of Insiders (today's or later - you can use in the command palette to check), and leave a comment letting us know what isn't working as expected. Happy Coding!
Yes
I'll mark this issue as verified as part of . Please file a new issue if the bug continues to occur on the latest Stable and/or Insiders versions of VS Code.

Related discussion:
text: return path.normalize(pathUri.fsPath); } <ins> // On Windows, there are cases in which the normalized path for a mapped folder contains a trailing `` // character (ex: serverfolder) due to the implementation of `path.normalize()`. This behaviour is // by design as documented in https://github.com/nodejs/node/issues/1765. if (repoUri.authority.length !== 0) { return repoPath.replace(/$/, ''); } </ins> } return repoPath;