Skip to content

MSYS2 git causes Error: spawn C:/msys64/usr/bin/git.exe ENOENT due to path format  #965

@Kwizatz

Description

@Kwizatz

Issue Type: Bug

Setting git.path to use git from a msys2 instalation ("C:/msys64/usr/bin/git.exe") causes extension to fail with the error:

Error: spawn C:/msys64/usr/bin/git.exe ENOENT

I have tracked the root cause for this to be that msys2 git prints paths in Unix format rather than Windows format unlike Git for Windows.

git rev-parse --show-toplevel prints /c/Code/AeonGUI on msys2 git,
but prints C:/Code/AeonGUI on Git for Windows.

This happens regardless of if the command is issued from inside bash or cmd.exe.

I looked for external solutions, an env var that could be set or a git config setting but found nothing other than calling cygpath -w "$(git rev-parse --show-toplevel)", which is not usable as a git.path or any other setting.

Steps to reproduce:

  1. Install MSYS2 from https://www.msys2.org
  2. Run MSYS2 bash for MinGW64
  3. Install git: pacman -S git
  4. Run vscode
  5. Set "git.path": "C:/msys64/usr/bin/git.exe" on settings.js
  6. Close and rerun vscode and open a file in a git repository
  7. The extension will likely fail at this point, but clicking the extension icon on the left pane will trigger more failures

Extension version: 10.2.1
VS Code version: Code 1.42.1 (c47d83b293181d9be64f27ff093689e8e7aed054, 2020-02-11T14:45:59.656Z)
OS version: Windows_NT x64 10.0.18363

GitlensLog.txt
GitlensGitLog.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedWant community input and/or pull requestneeds-championNeeds a community champion to move this forward

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions