Merge pull request #2754 from naderman/github-no-api

Make the github driver behave like git if "no-api" is specified.
main
Jordi Boggiano 10 years ago
commit c698c8655c

@ -292,6 +292,11 @@ The VCS driver to be used is detected automatically based on the URL. However,
should you need to specify one for whatever reason, you can use `git`, `svn` or
`hg` as the repository type instead of `vcs`.
If you set the `no-api` key to `true` on a github repository it will clone the
repository as it would with any other git repository instead of using the
GitHub API. But unlike using the `git` driver directly, composer will still
attempt to use github's zip files.
#### Subversion Options
Since Subversion has no native concept of branches and tags, Composer assumes

@ -52,6 +52,11 @@ class GitHubDriver extends VcsDriver
$this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
$this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
$this->setupGitDriver();
return;
}
$this->fetchRootIdentifier();
}
@ -405,14 +410,7 @@ class GitHubDriver extends VcsDriver
// GitHub returns 404 for private repositories) and we
// cannot ask for authentication credentials (because we
// are not interactive) then we fallback to GitDriver.
$this->gitDriver = new GitDriver(
array('url' => $this->generateSshUrl()),
$this->io,
$this->config,
$this->process,
$this->remoteFilesystem
);
$this->gitDriver->initialize();
$this->setupGitDriver();
return;
} catch (\RuntimeException $e) {
@ -422,4 +420,16 @@ class GitHubDriver extends VcsDriver
throw $e;
}
}
protected function setupGitDriver()
{
$this->gitDriver = new GitDriver(
array('url' => $this->generateSshUrl()),
$this->io,
$this->config,
$this->process,
$this->remoteFilesystem
);
$this->gitDriver->initialize();
}
}

Loading…
Cancel
Save