-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cached git path is wrong #2877
Comments
I am experiencing a similar issue. I have git installed in both windows and WSL. My default shell profile is WSL, and my
Upon further investigation, my issue appears to be caused by the inability to locate git at my specified path:
It seems the issue is specifically a cross-OS challenge in that |
@eamodio thanks for the proposed workaround, but it would not work for me. The need is to access the workspace from two (or more) different OS's, more or less simultaneously, for example with one vscode instance editing the workspace, and debugging on a CentOS host, then alt-tabbing to another vscode instance editing the same workspace but mounted under Ubuntu, etc. Your workaround would require me to clear the stored data every time I alt-tab - a very work-disrupting operation. I no longer use GitLens because any convenience is far outweighed by having to deal with the errors. This bug is a show stopper, at least for me. |
I've added a new Can you please verify that this change will work for you in tomorrow's ( You can switch to the pre-release edition of GitLens, by clicking on the "Switch to Pre-Release version of this extension" from the Extensions view. |
Description
VScode: 1.77.3 on Windows 10
Remote SSH to OS: CentOS 7 (sclo-git212 installed but not active)
GitLens v13.5.0
On the CentOS 7, PATH=/home/radu/bin/git/bin:/usr/local/bin:/usr/bin
I encounter this error:
The
error: bad index version 5
is expected, but running the sco-git212 is not expected.I expected the
~/bin/git/bin/git
(which supports "index version 5") binary to run, not/opt/rh/sclo-git212/root/usr/bin/git
Using strace, I found that the git process is forked by the
/home/radu/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/out/bootstrap-fork --type=extensionHost --transformURIs --useHostProxy=false
process, and confirmed that the git process's PATH environment is/home/radu/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/bin/remote-cli:/home/radu/bin/git/bin:/usr/local/bin:/usr/bin
- ie, does not contain the sclo path.When I initially installed GitLens, the CentOS7 host was configured to use sclo-git212 for vscode. After installing GitLens, I removed the sclo-git212 version and switched to my local experimental git,
~/bin/git/bin/git
, which implements the index version 5 that sclo-git212 is unable to understand.The problem seems to be that the GitLens extension somehow caches the path of the git binary at installation time, making it impossible to later change the underlying git version.
A workaround is:
killall node
on CentOS,After this, GitLens is able to use my local, experimental git
~/bin/git/bin/git
.My home directory is mounted on a CentOS host, as well as other Ubuntu hosts (hence, the vscode workspace is shared among hosts of different OS's). The
~/bin/git/bin/git
path, which GitLens caches after installing it on CentOS, is valid on CentOS, but not on Ubuntu. The Ubuntu hosts should be using a different git binary, not the cached path that GitLens insists on running.In short, GitLens appears to cache the path to the git binary at extension installation time, and reuses the same path on subsequent invocation. It should not cache the path at all, but simply run 'git', allowing the underlying configuration dictate, via $PATH, which executable to run.
GitLens Version
v13.5.0
VS Code Version
Version: 1.77.3 (user setup)
Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:16:02.548Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.17763
Sandboxed: No
Git Version
private experimental version: "git version 2.36.0.rc0.287.g77b638f.dirty" and others
Logs, Screenshots, Screen Captures, etc
No response
The text was updated successfully, but these errors were encountered: