microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.23k stars 29.29k forks source link

"Git changes not show in the file explorer" It is still a BUG #145382

Closed GoingMyWay closed 2 years ago

GoingMyWay commented 2 years ago

Hi, as I cannot reply to the issues: https://github.com/microsoft/vscode/issues/89104, https://github.com/microsoft/vscode/issues/89373, https://github.com/microsoft/vscode/issues/89143, https://github.com/microsoft/vscode/issues/90774 (all these issues are locked), I want to ask are there any workaround to fix these issues now? It seems downgrading git is not a feasible method. I tried many methods mentioned in these threads. And the price is I lost the code that cost me 3 hours to implement.

Could you please fix this issue? For me, the issue happens on the head node of a cluster when opening the project on the head node remotely.

lszomoru commented 2 years ago

@GoingMyWay, sorry to hear about losing data due to this issue. While these are all issues, I was wondering if you could share more about the version of VSCode and Git that you are using, as well as about your setup. When you say opening the project on the head node remotely, are you using any of our Remote extensions?

GoingMyWay commented 2 years ago

@lszomoru Hi, the current vs-code version is

Version: 1.64.0 (Universal)
Commit: 5554b12acf27056905806867f251c859323ff7e9
Date: 2022-02-03T04:20:17.224Z (1 mo ago)
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 21.4.0

and the git version of the remote machine is git version 2.34.1.

The issue happens when I open a remote project on my local machine.

I guess I am using the Remote - SSH extension. Hope someone can fix this issue.

lszomoru commented 2 years ago

@GoingMyWay, would you be able to create a screen recording illustrating the problem. That would help significantly with the investigation. Thank you very much!

GoingMyWay commented 2 years ago

@lszomoru

image

Hi, as shown in the figure, I clone the https://github.com/microsoft/vscode on the remote machine. I connect the remote machine and open this repo on my local machine. I made a change in the file, but the git does not show the change in the file explorer bar.

However, I cloned the repo on my local machine and opened the repo locally. It can show the changes.

image

This issue happens on opening a repo remotely on a head node of a cluster. You can easily reproduce this problem by connecting any supercomputers' head nodes or any clusters' head nodes.

I hope this issue can be resolved. You can find the same problems in other issues I mentioned above.

GoingMyWay commented 2 years ago

@lszomoru image

Hi, as shown in the figure, I clone the https://github.com/microsoft/vscode on the remote machine. I connect the remote machine and open this repo on my local machine. I made a change in the file, but the git does not show the change in the file explorer bar.

However, I cloned the repo on my local machine and opened the repo locally. It can show the changes.

image

This issue happens on opening a repo remotely on a head node of a cluster. You can easily reproduce this problem by connecting any supercomputers' head nodes or any clusters' head nodes.

I hope this issue can be resolved. You can find the same problems in other issues I mentioned above.

@lszomoru Hi, anything I can do for you to debug the issue?

lszomoru commented 2 years ago

@GoingMyWay, thank you very much for sharing the additional information. VS Code is using file system events to refresh various UI elements in the source control viewlet as well as the editor (ex: diff decorators shown in the editor gutter). Could you please implement the following steps both when opening the folder locally as well as on the remote:

  1. Open the folder/workspace in VS Code
  2. Enable file system logging as described in this wiki.
  3. Use the Git: Set Git Log Level... command and set the log level to Trace
  4. Make a change to a file and save it.
  5. Share the file system watcher logs and the contents of the git output that you can access using the Git: Show Git Output command.
GoingMyWay commented 2 years ago

@GoingMyWay, thank you very much for sharing the additional information. VS Code is using file system events to refresh various UI elements in the source control viewlet as well as the editor (ex: diff decorators shown in the editor gutter). Could you please implement the following steps both when opening the folder locally as well as on the remote:

  1. Open the folder/workspace in VS Code
  2. Enable file system logging as described in this wiki.
  3. Use the Git: Set Git Log Level... command and set the log level to Trace
  4. Make a change to a file and save it.
  5. Share the file system watcher logs and the contents of the git output that you can access using the Git: Show Git Output command.

@lszomoru Hi, the following is the output of step 5.

[2022-04-12T00:42:04.422Z] Validating found git in: git
[2022-04-12T00:42:04.481Z] Using git 2.34.1 from git
[2022-04-12T00:42:05.103Z] > git rev-parse --git-dir [340ms]
[2022-04-12T00:42:05.110Z] Open repository: /mnt/home/qiuwei/Projects/sail/game-ai/sail_marl
[2022-04-12T00:42:29.482Z] > git symbolic-ref --short HEAD [31ms]
[2022-04-12T00:42:29.536Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main [42ms]
[2022-04-12T00:42:29.597Z] > git remote --verbose [41ms]
[2022-04-12T00:42:29.614Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [66ms]
[2022-04-12T00:42:29.646Z] > git config --get commit.template [17ms]
[2022-04-12T00:42:30.200Z] > git rev-parse --git-dir [28ms]
[2022-04-12T00:42:30.204Z] Open repository: /mnt/home/qiuwei/Projects/sail/game-ai/sail_marl/third_party/meltingpot
[2022-04-12T00:42:30.306Z] > git rev-parse --git-dir [35ms]
[2022-04-12T00:42:30.309Z] Open repository: /mnt/home/qiuwei/Projects/sail/game-ai/sail_marl/third_party/ray
[2022-04-12T00:42:30.445Z] > git rev-parse --git-dir [38ms]
[2022-04-12T00:42:30.447Z] Open repository: /mnt/home/qiuwei/Projects/sail/game-ai/sail_marl/third_party/lb-foraging
[2022-04-12T00:42:30.619Z] > git symbolic-ref --short HEAD [41ms]
[2022-04-12T00:42:30.757Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master [129ms]
[2022-04-12T00:42:30.888Z] > git remote --verbose [113ms]
[2022-04-12T00:42:30.993Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [226ms]
[2022-04-12T00:42:31.145Z] > git config --get commit.template [139ms]
[2022-04-12T00:42:33.881Z] > git symbolic-ref --short HEAD [28ms]
[2022-04-12T00:42:33.881Z] fatal: ref HEAD is not a symbolic ref
[2022-04-12T00:42:33.919Z] > git rev-parse HEAD [27ms]
[2022-04-12T00:42:33.978Z] > git remote --verbose [43ms]
[2022-04-12T00:42:33.983Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [55ms]
[2022-04-12T00:42:34.019Z] > git config --get commit.template [22ms]
[2022-04-12T00:42:39.135Z] > git symbolic-ref --short HEAD [62ms]
[2022-04-12T00:42:39.135Z] fatal: ref HEAD is not a symbolic ref
[2022-04-12T00:42:39.168Z] > git rev-parse HEAD [26ms]
[2022-04-12T00:42:39.213Z] > git remote --verbose [31ms]
[2022-04-12T00:42:39.361Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [186ms]
[2022-04-12T00:42:39.393Z] > git config --get commit.template [15ms]
[2022-04-12T03:18:53.031Z] > git fetch [899ms]
[2022-04-12T03:18:53.463Z] > git fetch [1307ms]
[2022-04-12T03:18:53.595Z] > git fetch [1451ms]
[2022-04-12T03:18:53.891Z] > git symbolic-ref --short HEAD [62ms]
[2022-04-12T03:18:53.962Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master [60ms]
[2022-04-12T03:18:54.046Z] > git remote --verbose [63ms]
[2022-04-12T03:18:54.062Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [89ms]
[2022-04-12T03:18:54.080Z] > git fetch [1958ms]
[2022-04-12T03:18:54.080Z] From git.insea.io:sail/gameai/sail_marl
   20a4aea..fc7fc7d  main       -> origin/main
[2022-04-12T03:18:54.105Z] > git config --get commit.template [26ms]
[2022-04-12T03:18:58.955Z] > git symbolic-ref --short HEAD [47ms]
[2022-04-12T03:18:58.955Z] fatal: ref HEAD is not a symbolic ref
[2022-04-12T03:18:58.992Z] > git rev-parse HEAD [25ms]
[2022-04-12T03:18:59.095Z] > git remote --verbose [87ms]
[2022-04-12T03:18:59.104Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [103ms]
[2022-04-12T03:18:59.175Z] > git config --get commit.template [59ms]
[2022-04-12T03:19:09.409Z] > git symbolic-ref --short HEAD [22ms]
[2022-04-12T03:19:09.410Z] fatal: ref HEAD is not a symbolic ref
[2022-04-12T03:19:09.445Z] > git rev-parse HEAD [21ms]
[2022-04-12T03:19:09.494Z] > git remote --verbose [28ms]
[2022-04-12T03:19:09.498Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [42ms]
[2022-04-12T03:19:09.529Z] > git config --get commit.template [16ms]
[2022-04-12T03:19:09.793Z] > git symbolic-ref --short HEAD [21ms]
[2022-04-12T03:19:09.842Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main [41ms]
[2022-04-12T03:19:09.886Z] > git remote --verbose [29ms]
[2022-04-12T03:19:09.896Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [47ms]
[2022-04-12T03:19:09.920Z] > git config --get commit.template [11ms]
[2022-04-12T03:23:44.870Z] > git fetch [1071ms]
[2022-04-12T03:23:45.036Z] > git fetch [1249ms]
[2022-04-12T03:23:45.083Z] > git fetch [1260ms]
[2022-04-12T03:23:45.104Z] > git fetch [1293ms]
[2022-04-12T03:23:45.267Z] > git symbolic-ref --short HEAD [50ms]
[2022-04-12T03:23:46.966Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master [1679ms]
[2022-04-12T03:23:47.073Z] > git remote --verbose [80ms]
[2022-04-12T03:23:47.095Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [115ms]
[2022-04-12T03:23:47.149Z] > git config --get commit.template [41ms]
[2022-04-12T03:23:51.139Z] > git symbolic-ref --short HEAD [33ms]
[2022-04-12T03:23:51.139Z] fatal: ref HEAD is not a symbolic ref
[2022-04-12T03:23:51.176Z] > git rev-parse HEAD [26ms]
[2022-04-12T03:23:51.242Z] > git remote --verbose [43ms]
[2022-04-12T03:23:51.243Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [53ms]
[2022-04-12T03:23:51.276Z] > git config --get commit.template [22ms]
[2022-04-12T03:24:00.378Z] > git symbolic-ref --short HEAD [32ms]
[2022-04-12T03:24:00.379Z] fatal: ref HEAD is not a symbolic ref
[2022-04-12T03:24:00.416Z] > git rev-parse HEAD [26ms]
[2022-04-12T03:24:00.472Z] > git remote --verbose [39ms]
[2022-04-12T03:24:00.478Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [53ms]
[2022-04-12T03:24:00.520Z] > git config --get commit.template [24ms]
[2022-04-12T03:24:02.760Z] > git symbolic-ref --short HEAD [16ms]
[2022-04-12T03:24:02.811Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main [34ms]
[2022-04-12T03:24:02.856Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [35ms]
[2022-04-12T03:24:02.859Z] > git remote --verbose [27ms]
[2022-04-12T03:24:02.884Z] > git config --get commit.template [11ms]
[2022-04-12T03:24:28.861Z] > git log --oneline --cherry main...main@{upstream} -- [38ms]
[2022-04-12T03:24:30.408Z] > git pull --tags origin main [1537ms]
[2022-04-12T03:24:30.408Z] From git.insea.io:sail/gameai/sail_marl
 * branch            main       -> FETCH_HEAD
[2022-04-12T03:24:38.092Z] > git symbolic-ref --short HEAD [17ms]
[2022-04-12T03:24:38.153Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main [55ms]
[2022-04-12T03:24:38.260Z] > git remote --verbose [85ms]
[2022-04-12T03:24:38.277Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [112ms]
[2022-04-12T03:24:38.320Z] > git config --get commit.template [22ms]
[2022-04-12T03:26:51.459Z] > git fetch [1010ms]
[2022-04-12T03:26:51.562Z] > git symbolic-ref --short HEAD [17ms]
[2022-04-12T03:26:51.594Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master [25ms]
[2022-04-12T03:26:51.635Z] > git remote --verbose [27ms]
[2022-04-12T03:26:51.637Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [36ms]
[2022-04-12T03:26:51.660Z] > git config --get commit.template [13ms]
[2022-04-12T03:26:51.955Z] > git fetch [668ms]
[2022-04-12T03:26:54.161Z] > git symbolic-ref --short HEAD [17ms]
[2022-04-12T03:26:54.161Z] fatal: ref HEAD is not a symbolic ref
[2022-04-12T03:26:54.183Z] > git rev-parse HEAD [14ms]
[2022-04-12T03:26:54.224Z] > git remote --verbose [26ms]
[2022-04-12T03:26:54.225Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [34ms]
[2022-04-12T03:26:54.251Z] > git config --get commit.template [13ms]
[2022-04-12T03:27:01.258Z] > git fetch [725ms]
[2022-04-12T03:27:04.004Z] > git fetch [1107ms]
[2022-04-12T03:27:09.175Z] > git symbolic-ref --short HEAD [29ms]
[2022-04-12T03:27:09.175Z] fatal: ref HEAD is not a symbolic ref
[2022-04-12T03:27:09.211Z] > git rev-parse HEAD [25ms]
[2022-04-12T03:27:09.273Z] > git remote --verbose [41ms]
[2022-04-12T03:27:09.274Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [51ms]
[2022-04-12T03:27:09.306Z] > git config --get commit.template [21ms]
[2022-04-12T03:27:13.289Z] > git symbolic-ref --short HEAD [26ms]
[2022-04-12T03:27:13.334Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main [34ms]
[2022-04-12T03:27:13.379Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [33ms]
[2022-04-12T03:27:13.381Z] > git remote --verbose [24ms]
[2022-04-12T03:27:13.403Z] > git config --get commit.template [11ms]
[2022-04-12T03:27:17.121Z] Log level changed to: Trace

Note that, on head nodes of clusters, the /home/username is normally mounted to /mnt/home/username. I do not if such setting caused this issue.

GoingMyWay commented 2 years ago

@lszomoru Hi sir, is it possible to detect the issue?

lszomoru commented 2 years ago

Note that, on head nodes of clusters, the /home/username is normally mounted to /mnt/home/username. I do not if such setting caused this issue.

Yes, this might have something to do with what you are seeing. How do you open the folder/workspace when you are connected to the remote using the SSH extension? Are you using the cli (ex: code) or are you opening the folder using File -> Open Folder, or you are opening the folder/workspace by clicking on an item in the "Recent" list on the welcome screen?

Could you also please do a test for me:

  1. Open the folder/workspace while being connected to the remote
  2. Make a change to a file (ex: bootstrap-amd.js), and save the file
    • This file will not have the diff decorators in the editor. Do not close the file.
    • Does the file appear under "Changes" in the Source Control viewlet? If not, hit the "Refresh" button.
  3. Right click on the file in the "Changes" list and choose "Open File" from the context menu.
    • Does this action open a second editor instance with bootstrap-amd.js?
    • If so, does this file have the correct diff decorators in the editor?
    • If so, what is the path of this resource (you can get it when you hover over the editor tab)
GoingMyWay commented 2 years ago

@lszomoru Hi, I appreciate your work on debugging the issue.

thus improving the sample efficiency and increasing agent's performance.

Answer: I open the fold by opening the folder using File -> Open Folder.

Does the file appear under "Changes" in the Source Control viewlet? If not, hit the "Refresh" button.

Answer: Yes.

image

Does the file appear under "Changes" in the Source Control viewlet? If not, hit the "Refresh" button.

Answer: Yes. It also shows the correct diff decorators.

image

Hope my answers can help you to debug the issue. If you need any help, please let me know.

GoingMyWay commented 2 years ago

@lszomoru By the way, the git is also very slow. One has to wait for 5-10 seconds to wait for the response from the git. vs-code on cluster's head node performs really poor. It wastes a lot of time.

GoingMyWay commented 2 years ago

@lszomoru Hi, I appreciate your work on debugging the issue.

thus improving the sample efficiency and increasing agent's performance.

Answer: I open the fold by opening the folder using File -> Open Folder.

Does the file appear under "Changes" in the Source Control viewlet? If not, hit the "Refresh" button.

Answer: Yes.

image

Does the file appear under "Changes" in the Source Control viewlet? If not, hit the "Refresh" button.

Answer: Yes. It also shows the correct diff decorators.

image

Hope my answers can help you to debug the issue. If you need any help, please let me know.

@lszomoru Hi, I found a workaround to fix this issue, that is, opening the absolute path of /mnt/path/to/the/project/ and then the git can work. However, git still works very slow when using commit.

lszomoru commented 2 years ago

@GoingMyWay, apologies for not getting back to you on this until now, as the notification for the issue has gotten lost in my GitHub inbox. Thank you very much for implementing the requested steps and sharing the results. The information that you have shared that you are indeed running into the limitation that the git extension does not support symbolic links. That is a long standing feature request tracked in https://github.com/microsoft/vscode/issues/5970. Until support for symbolic links is added the only workaround is to open the absolute path, which you have already discovered.

I will go ahead and close this issue now. Thank you very much for your patience during the investigation.

vscodenpa commented 2 years ago

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines.

Happy Coding!

GoingMyWay commented 2 years ago

@GoingMyWay, apologies for not getting back to you on this until now, as the notification for the issue has gotten lost in my GitHub inbox. Thank you very much for implementing the requested steps and sharing the results. The information that you have shared that you are indeed running into the limitation that the git extension does not support symbolic links. That is a long standing feature request tracked in #5970. Until support for symbolic links is added the only workaround is to open the absolute path, which you have already discovered.

I will go ahead and close this issue now. Thank you very much for your patience during the investigation.

@lszomoru, thank you for the reply. I am looking forward to the new release supporting this feature.

lszomoru commented 2 years ago

@GoingMyWay, my pleasure. Please subscribe to https://github.com/microsoft/vscode/issues/5970 to get notified when the feature is implemented.