Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'upstream/master' into feature-dist

  • Loading branch information...
commit 55414ba3a12198fc4ee604e8388401e421564b1e 2 parents fe6bac4 + fa982a9
@till authored
View
2  .travis.yml
@@ -6,7 +6,7 @@ php:
- 5.4
before_script:
- - curl -s http://getcomposer.org/installer | php
+ - curl -s http://getcomposer.org/installer | php -- --quiet
- php composer.phar install
script: phpunit -c tests/complete.phpunit.xml
View
4 src/Composer/Command/CreateProjectCommand.php
@@ -19,6 +19,7 @@
use Composer\Repository\ComposerRepository;
use Composer\Repository\CompositeRepository;
use Composer\Repository\FilesystemRepository;
+use Composer\Repository\NotifiableRepositoryInterface;
use Composer\Repository\InstalledFilesystemRepository;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -125,6 +126,9 @@ public function installProject(IOInterface $io, $packageName, $directory = null,
$io->write('<info>Installing ' . $package->getName() . ' (' . VersionParser::formatVersion($package, false) . ')</info>', true);
$projectInstaller = new ProjectInstaller($directory, $dm);
$projectInstaller->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), $package);
+ if ($package->getRepository() instanceof NotifiableRepositoryInterface) {
+ $package->getRepository()->notifyInstall($package);
+ }
$io->write('<info>Created project in ' . $directory . '</info>', true);
chdir($directory);
View
6 src/Composer/Downloader/GitDownloader.php
@@ -28,6 +28,8 @@ public function doDownload(PackageInterface $package, $path)
$command = 'git clone %s %s && cd %2$s && git remote add composer %1$s && git fetch composer';
$this->io->write(" Cloning ".$ref);
+ // added in git 1.7.1, prevents prompting the user
+ putenv('GIT_ASKPASS=echo');
$commandCallable = function($url) use ($ref, $path, $command) {
return sprintf($command, escapeshellarg($url), escapeshellarg($path), escapeshellarg($ref));
};
@@ -140,7 +142,7 @@ protected function runCommand($commandCallable, $url, $path = null)
{
$handler = array($this, 'outputHandler');
- // github, autoswitch protocols
+ // public github, autoswitch protocols
if (preg_match('{^(?:https?|git)(://github.com/.*)}', $url, $match)) {
$protocols = array('git', 'https', 'http');
$messages = array();
@@ -162,7 +164,7 @@ protected function runCommand($commandCallable, $url, $path = null)
$command = call_user_func($commandCallable, $url);
if (0 !== $this->process->execute($command, $handler)) {
if (preg_match('{^git@github.com:(.+?)\.git$}i', $url, $match) && $this->io->isInteractive()) {
- // private repository without git access, try https with auth
+ // private github repository without git access, try https with auth
$retries = 3;
$retrying = false;
do {
View
2  src/Composer/Repository/Vcs/GitDriver.php
@@ -48,6 +48,8 @@ public function initialize()
$fs = new Filesystem();
$fs->removeDirectory($this->repoDir);
+ // added in git 1.7.1, prevents prompting the user
+ putenv('GIT_ASKPASS=echo');
$command = sprintf('git clone --mirror %s %s', escapeshellarg($this->url), escapeshellarg($this->repoDir));
if (0 !== $this->process->execute($command, $output)) {
$output = $this->process->getErrorOutput();
View
9 src/Composer/Repository/Vcs/GitHubDriver.php
@@ -259,7 +259,8 @@ protected function fetchRootIdentifier()
case 401:
case 404:
$this->isPrivate = true;
- if (!$this->io->isInteractive()) {
+
+ try {
// If this repository may be private (hard to say for sure,
// GitHub returns 404 for private repositories) and we
// cannot ask for authentication credentials (because we
@@ -274,6 +275,12 @@ protected function fetchRootIdentifier()
$this->gitDriver->initialize();
return;
+ } catch (\RuntimeException $e) {
+ $this->gitDriver = null;
+ if (!$this->io->isInteractive()) {
+ $this->io->write('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your username and password</error>');
+ throw $e;
+ }
}
$this->io->write('Authentication required (<info>'.$this->url.'</info>):');
$username = $this->io->ask('Username: ');
View
7 tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php
@@ -48,6 +48,11 @@ public function testPrivateRepository()
->setConstructorArgs(array($io))
->getMock();
+ $process = $this->getMock('Composer\Util\ProcessExecutor');
+ $process->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(1));
+
$remoteFilesystem->expects($this->at(0))
->method('getContents')
->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false))
@@ -72,7 +77,7 @@ public function testPrivateRepository()
->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false))
->will($this->returnValue('{"master_branch": "test_master"}'));
- $gitHubDriver = new GitHubDriver($repoUrl, $io, $this->config, null, $remoteFilesystem);
+ $gitHubDriver = new GitHubDriver($repoUrl, $io, $this->config, $process, $remoteFilesystem);
$gitHubDriver->initialize();
$this->setAttribute($gitHubDriver, 'tags', array($identifier => $sha));
Please sign in to comment.
Something went wrong with that request. Please try again.