Sfoglia il codice sorgente

Use refs API since it is more stable than the branches API with force-pushes, fixes #514

Jordi Boggiano 13 anni fa
parent
commit
2844a5673d
1 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. 3 2
      src/Composer/Repository/Vcs/GitHubDriver.php

+ 3 - 2
src/Composer/Repository/Vcs/GitHubDriver.php

@@ -173,10 +173,11 @@ class GitHubDriver extends VcsDriver
             return $this->gitDriver->getBranches();
         }
         if (null === $this->branches) {
-            $branchData = JsonFile::parseJson($this->getContents($this->getScheme() . '://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/branches'));
+            $branchData = JsonFile::parseJson($this->getContents($this->getScheme() . '://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads'));
             $this->branches = array();
             foreach ($branchData as $branch) {
-                $this->branches[$branch['name']] = $branch['commit']['sha'];
+                $name = substr($branch['ref'], 11);
+                $this->branches[$name] = $branch['object']['sha'];
             }
         }