Browse Source

Make SvnDriver::supports less greedy and more realistic

Jordi Boggiano 13 years ago
parent
commit
cd2e5bf2e0

+ 4 - 3
src/Composer/Repository/Vcs/SvnDriver.php

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

+ 0 - 5
tests/Composer/Test/Repository/Vcs/SvnDriverTest.php

@@ -58,15 +58,10 @@ class SvnDriverTest extends \PHPUnit_Framework_TestCase
             array('https://svn.sf.net', true),
             array('svn://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
      */
     public function testSupport($url, $assertion)