From 9afbddab6ba14cf4b90146d3ecfe8455be2895bd Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 6 Aug 2017 16:54:17 +0200 Subject: [PATCH] Only update dist references when one existed already, fixes #6363 --- src/Composer/Installer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 122a4e9f0..10744d541 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -1187,10 +1187,12 @@ class Installer } $package->setSourceReference($reference); - $package->setDistReference($reference); if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $package->getDistUrl())) { + $package->setDistReference($reference); $package->setDistUrl(preg_replace('{(?<=/)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl())); + } else if ($package->getDistReference()) { // update the dist reference if there was one, but if none was provided ignore it + $package->setDistReference($reference); } }