From be38f7e65d9b073d8668b4e232a45ed405821fd5 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 14 Apr 2017 00:08:27 +0200 Subject: [PATCH] Ignore headless mercurial branches in bitbucket API, fixes composer/packagist#778 --- src/Composer/Repository/Vcs/BitbucketDriver.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Composer/Repository/Vcs/BitbucketDriver.php b/src/Composer/Repository/Vcs/BitbucketDriver.php index 707e8189f..7fc137c44 100644 --- a/src/Composer/Repository/Vcs/BitbucketDriver.php +++ b/src/Composer/Repository/Vcs/BitbucketDriver.php @@ -321,6 +321,11 @@ abstract class BitbucketDriver extends VcsDriver ); $hasNext = true; while ($hasNext) { + // skip headless branches which seem to be deleted branches that bitbucket nevertheless returns in the API + if ($this->vcsType === 'hg' && empty($data['heads'])) { + continue; + } + $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource); foreach ($branchData['values'] as $data) { $this->branches[$data['name']] = $data['target']['hash'];