1
0
Fork 0

Only try to authorize when fetching the repo info, not subsequent calls, refs #423

pull/1191/merge
Jordi Boggiano 2012-10-19 10:23:50 +02:00
parent 348ec26c91
commit 5051e7a0a2
1 changed files with 8 additions and 3 deletions

View File

@ -238,7 +238,7 @@ class GitHubDriver extends VcsDriver
/**
* {@inheritDoc}
*/
protected function getContents($url, $tryClone = false)
protected function getContents($url, $fetchingRepoData = false)
{
try {
return parent::getContents($url);
@ -246,7 +246,12 @@ class GitHubDriver extends VcsDriver
switch ($e->getCode()) {
case 401:
case 404:
if (!$this->io->isInteractive() && $tryClone) {
// try to authorize only if we are fetching the main /repos/foo/bar data, otherwise it must be a real 404
if (!$fetchingRepoData) {
throw $e;
}
if (!$this->io->isInteractive()) {
return $this->attemptCloneFallback($e);
}
@ -256,7 +261,7 @@ class GitHubDriver extends VcsDriver
return parent::getContents($url);
case 403:
if (!$this->io->isInteractive() && $tryClone) {
if (!$this->io->isInteractive() && $fetchingRepoData) {
return $this->attemptCloneFallback($e);
}