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