composer-lock-diff icon indicating copy to clipboard operation
composer-lock-diff copied to clipboard

Doesn't work under Git Bash (MINGW64)

Open Bilge opened this issue 2 years ago • 3 comments

composer-lock-diff

The system cannot find the path specified. The system cannot find the path specified. 'git --version' exited with non-zero code '1' 'svn --version' exited with non-zero code '1' No loaders were found; perhaps your vcs cli tools are not installed, not in PATH, or otherwise unavailable

which git

/mingw64/bin/git

git --version

git version 2.38.0.windows.1

Bilge avatar Nov 05 '22 15:11 Bilge

Git is run in a Bourne Shell (sh) like this:

exec('sh -c "git --version" > /dev/null 2>&1', $_out, $exit);

If your mingw64 doesn't have sh in the path that'll be a problem. You can test with the following,

<?php
exec('sh -c "git --version" 2>&1', $out, $exit);
var_dump($out);
var_dump($exit);

Good output looks like this:

array(1) {
  [0]=>
  string(18) "git version 2.37.3"
}
int(0)

davidrjonas avatar Nov 06 '22 04:11 davidrjonas

$ php test.php
C:\test.php:3:
array(1) {
  [0] =>
  string(28) "git version 2.38.0.windows.1"
}
C:\test.php:4:
int(0)

Bilge avatar Nov 06 '22 10:11 Bilge

also ran over this problem with the latest version

staabm avatar Jan 23 '23 14:01 staabm