diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index 53d2b3ca9..b5bd73db6 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -71,10 +71,8 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface if ($this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref) && is_dir($cachePath)) { $this->cachedPackages[$package->getId()][$ref] = true; } - } else { - if (null === GitUtil::getVersion($this->process)) { - throw new \RuntimeException('git was not found in your PATH, skipping source download'); - } + } elseif (null === $gitVersion) { + throw new \RuntimeException('git was not found in your PATH, skipping source download'); } } diff --git a/src/Composer/Util/Hg.php b/src/Composer/Util/Hg.php index ecd01b144..a0ebac01d 100644 --- a/src/Composer/Util/Hg.php +++ b/src/Composer/Util/Hg.php @@ -20,6 +20,8 @@ use Composer\IO\IOInterface; */ class Hg { + private static $version = false; + /** * @var \Composer\IO\IOInterface */ @@ -90,7 +92,7 @@ class Hg { if (false === self::$version) { self::$version = null; - if (0 === $this->process->execute('hg --version', $output) && preg_match('/version (\d+(?:\.\d+)+)/m', $output, $matches)) { + if (0 === $process->execute('hg --version', $output) && preg_match('/version (\d+(?:\.\d+)+)/m', $output, $matches)) { self::$version = $matches[1]; } }