Pārlūkot izejas kodu

Merge pull request #154 from webfactory/fix_driver_detection

Fix driver detection
Jordi Boggiano 13 gadi atpakaļ
vecāks
revīzija
82a2a1f7ac

+ 2 - 1
src/Composer/Repository/ComposerRepository.php

@@ -26,7 +26,8 @@ class ComposerRepository extends ArrayRepository
 
     public function __construct(array $config)
     {
-        if (!preg_match('{^https?://}', $config['url'])) {
+        if (!preg_match('{^\w+://}', $config['url'])) {
+            // assume http as the default protocol
             $config['url'] = 'http://'.$config['url'];
         }
         $config['url'] = rtrim($config['url'], '/');

+ 2 - 3
src/Composer/Repository/Vcs/HgDriver.php

@@ -180,8 +180,7 @@ class HgDriver implements VcsDriverInterface
             return false;
         }
 
-        exec(sprintf('hg identify %s', escapeshellarg($url)), $output);
-
-        return (boolean)$output;
+        exec(sprintf('hg identify %s', escapeshellarg($url)), $ignored, $exit);
+        return $exit === 0;
     }
 }

+ 2 - 2
src/Composer/Repository/Vcs/SvnDriver.php

@@ -178,7 +178,7 @@ class SvnDriver implements VcsDriverInterface
             return false;
         }
 
-        exec(sprintf('svn info --non-interactive %s', escapeshellarg($url)), $output);
-        return preg_match('{^Repository UUID:}m', implode("\n", $output)) >= 1;
+        exec(sprintf('svn info --non-interactive %s 2>/dev/null', escapeshellarg($url)), $ignored, $exit);
+        return $exit === 0;
     }
 }