New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--patch-only
option for show
and outdated
commands
#10589
Conversation
…brary that offers type-safe preg_* replacements. composer/xdebug-handler 3.0.1 ! 3.0.3 Restarts a process without Xdebug. psr/container 1.1.1 ~ 2.0.1 Common Container Interface (PHP FIG PSR-11) symfony/console v5.4.3 ! v5.4.5 Eases the creation of beautiful and testable command line interfaces symfony/filesystem v5.4.3 ! v5.4.5 Provides basic utilities for the filesystem symfony/process v5.4.3 ! v5.4.5 Executes commands in sub-processes command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs tests.
@@ -1313,6 +1315,11 @@ private function findLatestPackage(PackageInterface $package, Composer $composer | |||
$targetVersion = '^' . $package->getVersion(); | |||
} | |||
|
|||
if ($targetVersion === null && $patchOnly) { | |||
$trimmedVersion = rtrim($package->getVersion(), '.0'); | |||
$targetVersion = '~' . $trimmedVersion; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks wrong. ~
is not a semver operator, and thus behaves differently on 0.x series to ^
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's correct for >=1 versions if you were not trimming (you need ~1.2.0
to restrict to 1.2.x, ~1.2
would behave like ^1.2
which is not what you want here), but for 0.x we need to ensure there are at least 3 dots in the version, e.g. ~0.1.2.0
would be fine for a 0.1.2 version, effectively pinning it to that version if the package has only 3 digits. If version was 0.1.2.3
tho it'd allow patch level releases to e.g. 0.1.2.*
Thanks for the PR, I fixed the implementation according to my comment above so I can get this out now 👍🏻 |
) Fixes composer#10503 Co-authored-by: Svyatoslav <tregubov.s@asteq.ru> Co-authored-by: Jordi Boggiano <j.boggiano@seld.be>
Add new option --patch-only for
show
andoutdated
commandsIssue #10503