1
0
Fork 0

Make SvnDriver::supports less greedy and more realistic

pull/498/head
Jordi Boggiano 2012-03-24 23:19:58 +01:00
parent 30d4080014
commit cd2e5bf2e0
2 changed files with 4 additions and 8 deletions

View File

@ -262,12 +262,13 @@ class SvnDriver extends VcsDriver
*/ */
public static function supports($url, $deep = false) public static function supports($url, $deep = false)
{ {
$url = self::fixSvnUrl($url); $url = self::normalizeUrl($url);
if (preg_match('#((^svn://)|(^svn\+ssh://)|(^file:///)|(^http)|(svn\.))#i', $url)) { if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
return true; return true;
} }
if (!$deep) { // proceed with deep check for local urls since they are fast to process
if (!$deep && !static::isLocalUrl($url)) {
return false; return false;
} }

View File

@ -58,15 +58,10 @@ class SvnDriverTest extends \PHPUnit_Framework_TestCase
array('https://svn.sf.net', true), array('https://svn.sf.net', true),
array('svn://example.org', true), array('svn://example.org', true),
array('svn+ssh://example.org', true), array('svn+ssh://example.org', true),
array('file:///d:/repository_name/project', true),
array('file:///repository_name/project', true),
array('/absolute/path', true),
); );
} }
/** /**
* Nail a bug in {@link SvnDriver::support()}.
*
* @dataProvider supportProvider * @dataProvider supportProvider
*/ */
public function testSupport($url, $assertion) public function testSupport($url, $assertion)