From 17747181d08e93d6ba783161919a0a9068ed55ef Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 9 Mar 2021 23:00:17 +0100 Subject: [PATCH] Clarify behavior of name in VCS repo, closes #9752 --- src/Composer/Repository/VcsRepository.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Composer/Repository/VcsRepository.php b/src/Composer/Repository/VcsRepository.php index 148f587d4..80d24f7a1 100644 --- a/src/Composer/Repository/VcsRepository.php +++ b/src/Composer/Repository/VcsRepository.php @@ -247,7 +247,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt continue; } - $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName; + $tagPackageName = $this->packageName ?: (isset($data['name']) ? $data['name'] : ''); if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) { if ($isVeryVerbose) { $this->io->writeError('Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally'); @@ -386,6 +386,8 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt protected function preProcess(VcsDriverInterface $driver, array $data, $identifier) { // keep the name of the main identifier for all packages + // this ensures that a package can be renamed in one place and that all old tags + // will still be installable using that new name without requiring re-tagging $dataPackageName = isset($data['name']) ? $data['name'] : null; $data['name'] = $this->packageName ?: $dataPackageName;