diff --git a/src/Composer/Repository/VcsRepository.php b/src/Composer/Repository/VcsRepository.php index 2d56efec6..71dda1e5f 100644 --- a/src/Composer/Repository/VcsRepository.php +++ b/src/Composer/Repository/VcsRepository.php @@ -37,20 +37,32 @@ class VcsRepository extends ArrayRepository $this->debug = $debug; } + public function getDriver() + { + foreach ($this->drivers as $driver) { + if ($driver::supports($this->url)) { + $driver = new $driver($this->url); + $driver->initialize(); + return $driver; + } + } + + foreach ($this->drivers as $driver) { + if ($driver::supports($this->url, true)) { + $driver = new $driver($this->url); + $driver->initialize(); + return $driver; + } + } + } + protected function initialize() { parent::initialize(); $debug = $this->debug; - foreach ($this->drivers as $driver) { - if ($driver::supports($this->url)) { - $driver = new $driver($this->url); - $driver->initialize(); - break; - } - } - + $driver = $this->getDriver(); if (!$driver) { throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url); }