1
0
Fork 0

Do not reset references on update mirrors if VCS type has changed

pull/7936/head
Nils Adermann 2019-11-07 17:42:17 +01:00
parent 2d37bb4116
commit cc274ebdf4
1 changed files with 6 additions and 1 deletions

View File

@ -158,9 +158,14 @@ class LockTransaction
foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) { foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) {
if (!($package instanceof AliasPackage) && !($package instanceof RootAliasPackage)) { if (!($package instanceof AliasPackage) && !($package instanceof RootAliasPackage)) {
// if we're just updating mirrors we need to reset references to the same as currently "present" packages' references to keep the lock file as-is // if we're just updating mirrors we need to reset references to the same as currently "present" packages' references to keep the lock file as-is
// we do not reset references if the currently present package didn't have any, or if the type of VCS has changed
if ($updateMirrors && !isset($this->presentMap[spl_object_hash($package)])) { if ($updateMirrors && !isset($this->presentMap[spl_object_hash($package)])) {
foreach ($this->presentMap as $presentPackage) { foreach ($this->presentMap as $presentPackage) {
if ($package->getName() == $presentPackage->getName() && $package->getVersion() == $presentPackage->getVersion() && $presentPackage->getSourceReference()) { if ($package->getName() == $presentPackage->getName() &&
$package->getVersion() == $presentPackage->getVersion() &&
$presentPackage->getSourceReference() &&
$presentPackage->getSourceType() === $package->getSourceType()
) {
$package->setSourceDistReferences($presentPackage->getSourceReference()); $package->setSourceDistReferences($presentPackage->getSourceReference());
} }
} }