Skip to content

Commit

Permalink
Pick higher revision number to guarantee successful file retrieval (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AnrDaemon authored Mar 17, 2023
1 parent 1a3f986 commit 3b16937
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/Composer/Repository/Vcs/SvnDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,19 @@ public function getTags(): array
if ($this->tagsPath !== false) {
$output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
if ($output) {
$lastRev = null;
foreach ($this->process->splitLines($output) as $line) {
$line = trim($line);
if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
if (isset($match[1], $match[2]) && $match[2] !== './') {
$tags[rtrim($match[2], '/')] = $this->buildIdentifier(
'/' . $this->tagsPath . '/' . $match[2],
$match[1]
);
if (isset($match[1], $match[2])) {
if ($match[2] === './') {
$lastRev = $match[1];
} else {
$tags[rtrim($match[2], '/')] = $this->buildIdentifier(
'/' . $this->tagsPath . '/' . $match[2],
max($lastRev, $match[1])
);
}
}
}
}
Expand Down Expand Up @@ -291,14 +296,19 @@ public function getBranches(): array
if ($this->branchesPath !== false) {
$output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
if ($output) {
$lastRev = null;
foreach ($this->process->splitLines(trim($output)) as $line) {
$line = trim($line);
if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
if (isset($match[1], $match[2]) && $match[2] !== './') {
$branches[rtrim($match[2], '/')] = $this->buildIdentifier(
'/' . $this->branchesPath . '/' . $match[2],
$match[1]
);
if (isset($match[1], $match[2])) {
if ($match[2] === './') {
$lastRev = $match[1];
} else {
$branches[rtrim($match[2], '/')] = $this->buildIdentifier(
'/' . $this->branchesPath . '/' . $match[2],
max($lastRev, $match[1])
);
}
}
}
}
Expand Down

0 comments on commit 3b16937

Please sign in to comment.