From 58e38b111dd40eb29394cdbb41846157d9e6ddec Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 10 Jan 2025 09:01:18 +0100 Subject: [PATCH] Copy source ref to dist ref if a custom dist info is present in non-dist-supporting drivers, fixes #12237 --- src/Composer/Repository/VcsRepository.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Composer/Repository/VcsRepository.php b/src/Composer/Repository/VcsRepository.php index 6ca321e58..5aaea602d 100644 --- a/src/Composer/Repository/VcsRepository.php +++ b/src/Composer/Repository/VcsRepository.php @@ -443,6 +443,11 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt $data['source'] = $driver->getSource($identifier); } + // if custom dist info is provided but does not provide a reference, copy the source reference to it + if (is_array($data['dist']) && !isset($data['dist']['reference']) && isset($data['source']['reference'])) { + $data['dist']['reference'] = $data['source']['reference']; + } + return $data; }