Permalink
Browse files

Revert previous change, use GIT_ASKPASS env var instead

  • Loading branch information...
1 parent 4ee1ff4 commit 656feda837263cf712c3f78dfb15aedbd274fe90 @Seldaek Seldaek committed Jun 27, 2012
@@ -25,9 +25,11 @@ class GitDownloader extends VcsDownloader
public function doDownload(PackageInterface $package, $path)
{
$ref = $package->getSourceReference();
- $command = 'git clone -c core.askpass=echo %s %s && cd %2$s && git remote add composer %1$s && git fetch composer';
+ $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));
};
@@ -48,7 +48,9 @@ public function initialize()
$fs = new Filesystem();
$fs->removeDirectory($this->repoDir);
- $command = sprintf('git clone -c core.askpass=echo --mirror %s %s', escapeshellarg($this->url), escapeshellarg($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();
@@ -276,6 +276,7 @@ protected function fetchRootIdentifier()
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;
@@ -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));

0 comments on commit 656feda

Please sign in to comment.