1
0
Fork 0

Skip parsing equal branches/tags to avoid failures in packagist down the line

pull/7162/head
Jordi Boggiano 2018-03-05 23:34:22 +01:00
parent 1dc78c1ad9
commit 4d8b9be5b6
1 changed files with 16 additions and 1 deletions

View File

@ -188,6 +188,13 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
continue; continue;
} }
if ($existingPackage = $this->findPackage($data['name'], $data['version_normalized'])) {
if ($verbose) {
$this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
}
continue;
}
if ($verbose) { if ($verbose) {
$this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')'); $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
} }
@ -205,7 +212,8 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
$this->io->overwriteError('', false); $this->io->overwriteError('', false);
} }
foreach ($driver->getBranches() as $branch => $identifier) { $branches = $driver->getBranches();
foreach ($branches as $branch => $identifier) {
$msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)'; $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
if ($verbose) { if ($verbose) {
$this->io->writeError($msg); $this->io->writeError($msg);
@ -213,6 +221,13 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
$this->io->overwriteError($msg, false); $this->io->overwriteError($msg, false);
} }
if ($branch === 'trunk' && isset($branches['master'])) {
if ($verbose) {
$this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
}
continue;
}
if (!$parsedBranch = $this->validateBranch($branch)) { if (!$parsedBranch = $this->validateBranch($branch)) {
if ($verbose) { if ($verbose) {
$this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>'); $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');