Add support for new GitHub API

main
Jordi Boggiano 12 years ago
parent a264219f07
commit 7a28a2d83a

@ -33,14 +33,14 @@ class GitHubDriver extends VcsDriver
/** /**
* Git Driver * Git Driver
* *
* @var GitDriver * @var GitDriver
*/ */
protected $gitDriver; protected $gitDriver;
/** /**
* Constructor * Constructor
* *
* @param string $url * @param string $url
* @param IOInterface $io * @param IOInterface $io
* @param ProcessExecutor $process * @param ProcessExecutor $process
@ -193,7 +193,7 @@ class GitHubDriver extends VcsDriver
/** /**
* Generate an SSH URL * Generate an SSH URL
* *
* @return string * @return string
*/ */
protected function generateSshUrl() protected function generateSshUrl()
@ -203,7 +203,7 @@ class GitHubDriver extends VcsDriver
/** /**
* Fetch root identifier from GitHub * Fetch root identifier from GitHub
* *
* @throws TransportException * @throws TransportException
*/ */
protected function fetchRootIdentifier() protected function fetchRootIdentifier()
@ -216,7 +216,13 @@ class GitHubDriver extends VcsDriver
} }
try { try {
$repoData = JsonFile::parseJson($this->getContents($repoDataUrl)); $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) { } catch (TransportException $e) {
switch($e->getCode()) { switch($e->getCode()) {
case 401: case 401:

Loading…
Cancel
Save