From cc274ebdf4417f13a7197efcfb72aa34bea32733 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 7 Nov 2019 17:42:17 +0100 Subject: [PATCH] Do not reset references on update mirrors if VCS type has changed --- src/Composer/DependencyResolver/LockTransaction.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Composer/DependencyResolver/LockTransaction.php b/src/Composer/DependencyResolver/LockTransaction.php index 7255de3dd..293f4a43b 100644 --- a/src/Composer/DependencyResolver/LockTransaction.php +++ b/src/Composer/DependencyResolver/LockTransaction.php @@ -158,9 +158,14 @@ class LockTransaction foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) { 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 + // 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)])) { 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()); } }