1
0
Fork 0

Avoid updating the lock hash if there is no lock

pull/12203/head
Jordi Boggiano 2024-11-14 11:05:32 +01:00
parent a39f57bcd7
commit f1163bdbd4
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View File

@ -216,7 +216,7 @@ EOT
$io->write('<info>No requirements to update in '.$composerJsonPath.'.</info>'); $io->write('<info>No requirements to update in '.$composerJsonPath.'.</info>');
} }
if (!$dryRun && $composer->getLocker()->isLocked() && $changeCount > 0) { if (!$dryRun && $composer->getLocker()->isLocked() && $composer->getConfig()->get('lock') && $changeCount > 0) {
$composer->getLocker()->updateHash($composerJson); $composer->getLocker()->updateHash($composerJson);
} }

View File

@ -554,7 +554,7 @@ EOT
if (!$dryRun) { if (!$dryRun) {
$this->updateFile($this->json, $requirements, $requireKey, $removeKey, $sortPackages); $this->updateFile($this->json, $requirements, $requireKey, $removeKey, $sortPackages);
if ($locker->isLocked()) { if ($locker->isLocked() && $composer->getConfig()->get('lock')) {
$stabilityFlags = RootPackageLoader::extractStabilityFlags($requirements, $composer->getPackage()->getMinimumStability(), []); $stabilityFlags = RootPackageLoader::extractStabilityFlags($requirements, $composer->getPackage()->getMinimumStability(), []);
$locker->updateHash($this->json, function (array $lockData) use ($stabilityFlags) { $locker->updateHash($this->json, function (array $lockData) use ($stabilityFlags) {
foreach ($stabilityFlags as $packageName => $flag) { foreach ($stabilityFlags as $packageName => $flag) {