@ -95,17 +95,12 @@ class GitDownloader extends VcsDownloader
}
}
// failed to checkout, first check git accessibility
// failed to checkout, first check git accessibility
$output = $this->process->getErrorOutput();
$this->throwException('Failed to clone ' . $url .' via git, https and http protocols, aborting.' . "\n\n" . $this->process->getErrorOutput(), $url);
if (127 === $this->process->execute('git --version', $handler)) {
throw new \RuntimeException('Failed to checkout ' . $url . ' via git, it isn\'t accessible through the console, please check your installation and your PATH env.' . "\n\n" . $this->process->getErrorOutput());
}
throw new \RuntimeException('Failed to checkout ' . $url .' via git, https and http protocols, aborting.' . "\n\n" . $output);
@ -119,6 +114,15 @@ class GitDownloader extends VcsDownloader
}
}
}
}
protected function throwException($message, $url)
{
if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
throw new \RuntimeException('Failed to clone '.$url.', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
}
throw new \RuntimeException($message);
}
protected function setPushUrl(PackageInterface $package, $path)
protected function setPushUrl(PackageInterface $package, $path)
@ -55,11 +55,11 @@ class GitDriver extends VcsDriver
if (0 !== $this->process->execute($command, $output)) {
if (0 !== $this->process->execute($command, $output)) {
$output = $this->process->getErrorOutput();
$output = $this->process->getErrorOutput();
if (127 === $this->process->execute('git --version', $handler)) {
if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
throw new \RuntimeException('Failed to clone '.$this->url.', git isn\'t accessible through the console, please check your installation and your PATH env.' . "\n\n" . $this->process->getErrorOutput());
throw new \RuntimeException('Failed to clone '.$this->url.', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
}
}
throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it ('.$output.')');
throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);