1
0
Fork 0

Merge pull request #311 from Seldaek/allow_local_fs

Allow local file system git repos & do not restrict to valid http* urls
pull/313/merge
Nils Adermann 2012-02-18 03:14:58 -08:00
commit 3167cccb6f
2 changed files with 9 additions and 4 deletions

View File

@ -169,6 +169,15 @@ class GitDriver extends VcsDriver implements VcsDriverInterface
return true;
}
// local filesystem
if (preg_match('{^(file://|/|[a-z]:[\\\\/])}', $url)) {
$process = new ProcessExecutor();
// check whether there is a git repo in that path
if ($process->execute(sprintf('cd %s && git show', escapeshellarg($url)), $output) === 0) {
return true;
}
}
if (!$deep) {
return false;
}

View File

@ -19,10 +19,6 @@ class VcsRepository extends ArrayRepository
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(
'Composer\Repository\Vcs\GitHubDriver',
'Composer\Repository\Vcs\GitBitbucketDriver',