From 7a28a2d83a4a61d9b235feae7a4f233213189ba4 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 29 Mar 2012 17:52:24 +0200 Subject: [PATCH] Add support for new GitHub API --- src/Composer/Repository/Vcs/GitHubDriver.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index 70ea2bd38..efe1a89a4 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -33,14 +33,14 @@ class GitHubDriver extends VcsDriver /** * Git Driver - * + * * @var GitDriver */ protected $gitDriver; /** * Constructor - * + * * @param string $url * @param IOInterface $io * @param ProcessExecutor $process @@ -193,7 +193,7 @@ class GitHubDriver extends VcsDriver /** * Generate an SSH URL - * + * * @return string */ protected function generateSshUrl() @@ -203,7 +203,7 @@ class GitHubDriver extends VcsDriver /** * Fetch root identifier from GitHub - * + * * @throws TransportException */ protected function fetchRootIdentifier() @@ -216,7 +216,13 @@ class GitHubDriver extends VcsDriver } try { $repoData = JsonFile::parseJson($this->getContents($repoDataUrl)); - $this->rootIdentifier = $repoData['master_branch'] ?: 'master'; + if (isset($repoData['default_branch'])) { + $this->rootIdentifier = $repoData['default_branch']; + } elseif (isset($repoData['master_branch'])) { + $this->rootIdentifier = $repoData['master_branch']; + } else { + $this->rootIdentifier = 'master'; + } } catch (TransportException $e) { switch($e->getCode()) { case 401: