Bladeren bron

Allow disabling svn branches/tags, fixes composer/satis#43

Jordi Boggiano 12 jaren geleden
bovenliggende
commit
5b24a48827
2 gewijzigde bestanden met toevoegingen van 23 en 16 verwijderingen
  1. 3 0
      doc/05-repositories.md
  2. 20 16
      src/Composer/Repository/Vcs/SvnDriver.php

+ 3 - 0
doc/05-repositories.md

@@ -259,6 +259,9 @@ repository like this:
         ]
     }
 
+If you have no branches or tags directory you can disable them entirely by
+setting the `branches-path` or `tags-path` to `false`.
+
 ### PEAR
 
 It is possible to install packages from any PEAR channel by using the `pear`

+ 20 - 16
src/Composer/Repository/Vcs/SvnDriver.php

@@ -160,14 +160,16 @@ class SvnDriver extends VcsDriver
         if (null === $this->tags) {
             $this->tags = array();
 
-            $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
-            if ($output) {
-                foreach ($this->process->splitLines($output) as $line) {
-                    $line = trim($line);
-                    if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
-                        if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
-                            $this->tags[rtrim($match[2], '/')] = '/' . $this->tagsPath .
-                                '/' . $match[2] . '@' . $match[1];
+            if ($this->tagsPath !== false) {
+                $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
+                if ($output) {
+                    foreach ($this->process->splitLines($output) as $line) {
+                        $line = trim($line);
+                        if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
+                            if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
+                                $this->tags[rtrim($match[2], '/')] = '/' . $this->tagsPath .
+                                    '/' . $match[2] . '@' . $match[1];
+                            }
                         }
                     }
                 }
@@ -200,14 +202,16 @@ class SvnDriver extends VcsDriver
             }
             unset($output);
 
-            $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
-            if ($output) {
-                foreach ($this->process->splitLines(trim($output)) as $line) {
-                    $line = trim($line);
-                    if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
-                        if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
-                            $this->branches[rtrim($match[2], '/')] = '/' . $this->branchesPath .
-                                '/' . $match[2] . '@' . $match[1];
+            if ($this->branchesPath !== false) {
+                $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
+                if ($output) {
+                    foreach ($this->process->splitLines(trim($output)) as $line) {
+                        $line = trim($line);
+                        if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
+                            if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
+                                $this->branches[rtrim($match[2], '/')] = '/' . $this->branchesPath .
+                                    '/' . $match[2] . '@' . $match[1];
+                            }
                         }
                     }
                 }