Skip to content

Commit

Permalink
Fix 9999999-dev showing on composer show when no branch alias is defi…
Browse files Browse the repository at this point in the history
…ned for the default branch, fixes #10260
  • Loading branch information
Seldaek committed Nov 8, 2021
1 parent 5b47fa1 commit 9f433ab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Composer/Command/ShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,11 @@ protected function getPackage(InstalledRepository $installedRepo, RepositoryInte
}
$matches = $pool->whatProvides($name, $constraint);
foreach ($matches as $index => $package) {
// avoid showing the 9999999-dev alias if the default branch has no branch-alias set
if ($package instanceof AliasPackage && $package->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
$package = $package->getAliasOf();
}

// select an exact match if it is in the installed repo and no specific version was required
if (null === $version && $installedRepo->hasPackage($package)) {
$matchedPackage = $package;
Expand Down

0 comments on commit 9f433ab

Please sign in to comment.