function DiagnoseCommand::checkGit
1 call to DiagnoseCommand::checkGit()
- DiagnoseCommand::execute in vendor/
composer/ composer/ src/ Composer/ Command/ DiagnoseCommand.php - Executes the current command.
File
-
vendor/
composer/ composer/ src/ Composer/ Command/ DiagnoseCommand.php, line 299
Class
- DiagnoseCommand
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\CommandCode
private function checkGit() : string {
if (!function_exists('proc_open')) {
return '<comment>proc_open is not available, git cannot be used</comment>';
}
$this->process
->execute([
'git',
'config',
'color.ui',
], $output);
if (strtolower(trim($output)) === 'always') {
return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
}
$gitVersion = Git::getVersion($this->process);
if (null === $gitVersion) {
return '<comment>No git process found</>';
}
if (version_compare('2.24.0', $gitVersion, '>')) {
return '<warning>Your git version (' . $gitVersion . ') is too old and possibly will cause issues. Please upgrade to git 2.24 or above</>';
}
return '<info>OK</> <comment>git version ' . $gitVersion . '</>';
}