Skip to content

Cached git path is wrong #2877

Closed
Closed
@drok

Description

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:

[2023-08-22 20:19:01.583] GenerateCommitMessageCommand
Error: Command failed: /opt/rh/sclo-git212/root/usr/bin/git -c core.quotepath=false -c color.ui=false -c log.showSignature=false diff -U3 --staged --
error: bad index version 5

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:

  1. uninstall GitLens
  2. exit vscode
  3. killall node on CentOS,
  4. start vscode
  5. install GitLens

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugSomething isn't workingneeds-verificationRequest for verification

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions