Merge branch '2.3'
commit
f1877afc0b
|
@ -255,6 +255,11 @@ abstract class BaseCommand extends Command
|
|||
}
|
||||
}
|
||||
}
|
||||
if (true == $input->hasOption('update-no-dev')) {
|
||||
if (true !== $input->getOption('update-no-dev') && true == Platform::getEnv('COMPOSER_NO_DEV')) {
|
||||
$input->setOption('update-no-dev', true);
|
||||
}
|
||||
}
|
||||
|
||||
if (true === $input->hasOption('ignore-platform-reqs')) {
|
||||
if (!$input->getOption('ignore-platform-reqs') && (bool) Platform::getEnv('COMPOSER_IGNORE_PLATFORM_REQS')) {
|
||||
|
|
|
@ -59,7 +59,7 @@ class GitHubDriver extends VcsDriver
|
|||
*/
|
||||
public function initialize(): void
|
||||
{
|
||||
if (!Preg::isMatch('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match)) {
|
||||
if (!Preg::isMatch('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#', $this->url, $match)) {
|
||||
throw new \InvalidArgumentException(sprintf('The GitHub repository URL %s is invalid.', $this->url));
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ class GitHubDriver extends VcsDriver
|
|||
*/
|
||||
public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
|
||||
{
|
||||
if (!Preg::isMatch('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
|
||||
if (!Preg::isMatch('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#', $url, $matches)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -305,14 +305,16 @@ class GitHubDriverTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @dataProvider invalidUrlProvider
|
||||
* @param string $url
|
||||
* @return void
|
||||
*/
|
||||
public function initializeInvalidReoUrl(): void
|
||||
public function testInitializeInvalidRepoUrl($url): void
|
||||
{
|
||||
$this->expectException('\InvalidArgumentException');
|
||||
|
||||
$repoConfig = array(
|
||||
'url' => 'https://github.com/acme',
|
||||
'url' => $url,
|
||||
);
|
||||
|
||||
$io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
|
||||
|
@ -324,6 +326,18 @@ class GitHubDriverTest extends TestCase
|
|||
$gitHubDriver->initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{string}>
|
||||
*/
|
||||
public function invalidUrlProvider()
|
||||
{
|
||||
return array(
|
||||
array('https://github.com/acme'),
|
||||
array('https://github.com/acme/repository/releases'),
|
||||
array('https://github.com/acme/repository/pulls'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider supportsProvider
|
||||
* @param bool $expected
|
||||
|
@ -345,6 +359,8 @@ class GitHubDriverTest extends TestCase
|
|||
array(false, 'https://github.com/acme'),
|
||||
array(true, 'https://github.com/acme/repository'),
|
||||
array(true, 'git@github.com:acme/repository.git'),
|
||||
array(false, 'https://github.com/acme/repository/releases'),
|
||||
array(false, 'https://github.com/acme/repository/pulls'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue