1
0
Fork 0

Allow local file system git repos & do not restrict to valid http* urls

pull/311/head
Jordi Boggiano 2012-02-18 12:00:30 +01:00
parent cac51b1baf
commit f152fe723d
2 changed files with 9 additions and 4 deletions

View File

@ -169,6 +169,15 @@ class GitDriver extends VcsDriver implements VcsDriverInterface
return true; return true;
} }
// local filesystem
if (preg_match('{^(file://|/|[a-z]:[\\\\/])}', $url)) {
$process = new ProcessExecutor();
$process->execute(sprintf('cd %s && git log -1 --format=%%at', escapeshellarg($url)), $output);
if (is_numeric(trim($output))) {
return true;
}
}
if (!$deep) { if (!$deep) {
return false; return false;
} }

View File

@ -19,10 +19,6 @@ class VcsRepository extends ArrayRepository
public function __construct(array $config, IOInterface $io, array $drivers = null) public function __construct(array $config, IOInterface $io, array $drivers = null)
{ {
if (!filter_var($config['url'], FILTER_VALIDATE_URL)) {
throw new \UnexpectedValueException('Invalid url given for VCS repository: '.$config['url']);
}
$this->drivers = $drivers ?: array( $this->drivers = $drivers ?: array(
'Composer\Repository\Vcs\GitHubDriver', 'Composer\Repository\Vcs\GitHubDriver',
'Composer\Repository\Vcs\GitBitbucketDriver', 'Composer\Repository\Vcs\GitBitbucketDriver',