Skip to content
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

Merged
merged 6 commits into from Mar 15, 2022

Conversation

stregubov
Copy link
Contributor

@stregubov stregubov commented Mar 4, 2022

Add new option --patch-only for show and outdated commands
Issue #10503

Svyatoslav and others added 4 commits Feb 28, 2022
…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
Copy link
Contributor

@GrahamCampbell GrahamCampbell left a comment

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;
Copy link
Contributor

@GrahamCampbell GrahamCampbell Mar 15, 2022

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 ^.

Copy link
Member

@Seldaek Seldaek Mar 15, 2022

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.*

@Seldaek Seldaek added this to the 2.3 milestone Mar 15, 2022
@Seldaek Seldaek merged commit f863855 into composer:main Mar 15, 2022
17 checks passed
@Seldaek
Copy link
Member

@Seldaek Seldaek commented Mar 15, 2022

Thanks for the PR, I fixed the implementation according to my comment above so I can get this out now 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants