Add support for unixy paths in git/hg local repo urls, closes #3294
parent
55a6a1c3d4
commit
91ac3e1426
|
@ -225,12 +225,12 @@ class GitDriver extends VcsDriver
|
|||
|
||||
// local filesystem
|
||||
if (Filesystem::isLocalPath($url)) {
|
||||
$url = Filesystem::getPlatformPath($url);
|
||||
if (!is_dir($url)) {
|
||||
throw new \RuntimeException('Directory does not exist: '.$url);
|
||||
}
|
||||
|
||||
$process = new ProcessExecutor();
|
||||
$url = str_replace('file://', '', $url);
|
||||
$process = new ProcessExecutor($io);
|
||||
// check whether there is a git repo in that path
|
||||
if ($process->execute('git tag', $output, $url) === 0) {
|
||||
return true;
|
||||
|
|
|
@ -198,12 +198,12 @@ class HgDriver extends VcsDriver
|
|||
|
||||
// local filesystem
|
||||
if (Filesystem::isLocalPath($url)) {
|
||||
$url = Filesystem::getPlatformPath($url);
|
||||
if (!is_dir($url)) {
|
||||
throw new \RuntimeException('Directory does not exist: '.$url);
|
||||
}
|
||||
|
||||
$process = new ProcessExecutor();
|
||||
$url = str_replace('file://', '', $url);
|
||||
// check whether there is a hg repo in that path
|
||||
if ($process->execute('hg summary', $output, $url) === 0) {
|
||||
return true;
|
||||
|
|
|
@ -46,7 +46,7 @@ abstract class VcsDriver implements VcsDriverInterface
|
|||
final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
|
||||
{
|
||||
if (Filesystem::isLocalPath($repoConfig['url'])) {
|
||||
$repoConfig['url'] = preg_replace('{^file://}', '', $repoConfig['url']);
|
||||
$repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
|
||||
}
|
||||
|
||||
$this->url = $repoConfig['url'];
|
||||
|
|
|
@ -461,6 +461,15 @@ class Filesystem
|
|||
return (bool) preg_match('{^(file://|/|[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
|
||||
}
|
||||
|
||||
public static function getPlatformPath($path)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$path = preg_replace('{^(?:file:///([a-z])/)}i', 'file://$1:/', $path);
|
||||
}
|
||||
|
||||
return preg_replace('{^file://}i', '', $path);
|
||||
}
|
||||
|
||||
protected function directorySize($directory)
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
|
||||
|
|
Loading…
Reference in New Issue