diff --git a/src/App/ProjectImport/LockFileFetcher.php b/src/App/ProjectImport/LockFileFetcher.php index a1bc043..8bc66f4 100644 --- a/src/App/ProjectImport/LockFileFetcher.php +++ b/src/App/ProjectImport/LockFileFetcher.php @@ -15,16 +15,18 @@ public function __construct(private readonly VcsDriverFactory $vcsDriverFactory) public function getLockContents(string $vcsUrl): ?string { - try { - $vcsDriver = $this->vcsDriverFactory->getDriver($vcsUrl); + $vcsDriver = $this->vcsDriverFactory->getDriver($vcsUrl); - return $vcsDriver->getFileContent('composer.lock', 'master'); - } catch (TransportException $exception) { - if (404 === $exception->getStatusCode()) { - return null; + foreach (['main', 'master'] as $branch) { + try { + return $vcsDriver->getFileContent('composer.lock', $branch); + } catch (TransportException $exception) { + if (404 !== $exception->getStatusCode()) { + throw $exception; + } } - - throw $exception; } + + return null; } }