Browse Source

Ignore headless mercurial branches in bitbucket API, fixes composer/packagist#778

Jordi Boggiano 8 years ago
parent
commit
be38f7e65d
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/Composer/Repository/Vcs/BitbucketDriver.php

+ 5 - 0
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'];