1
0
Fork 0

Merge remote-tracking branch 'channelgrabber/GitSpeedIncrease'

pull/5845/head
Jordi Boggiano 2016-11-03 12:08:28 +01:00
commit 208086d8e3
2 changed files with 8 additions and 8 deletions

View File

@ -105,10 +105,10 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
$ref = $target->getSourceReference(); $ref = $target->getSourceReference();
$this->io->writeError(" Checking out ".$ref); $this->io->writeError(" Checking out ".$ref);
$command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer'; $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s^{commit} || (git fetch composer && git fetch --tags composer)';
$commandCallable = function ($url) use ($command) { $commandCallable = function ($url) use ($command, $ref) {
return sprintf($command, ProcessExecutor::escape($url)); return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
}; };
$this->gitUtil->runCommand($commandCallable, $url, $path); $this->gitUtil->runCommand($commandCallable, $url, $path);

View File

@ -371,7 +371,7 @@ class GitDownloaderTest extends TestCase
public function testUpdate() public function testUpdate()
{ {
$expectedGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git fetch composer && git fetch --tags composer"); $expectedGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref'^{commit} || (git fetch composer && git fetch --tags composer)");
$packageMock = $this->getMock('Composer\Package\PackageInterface'); $packageMock = $this->getMock('Composer\Package\PackageInterface');
$packageMock->expects($this->any()) $packageMock->expects($this->any())
@ -420,7 +420,7 @@ class GitDownloaderTest extends TestCase
public function testUpdateWithNewRepoUrl() public function testUpdateWithNewRepoUrl()
{ {
$expectedGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git fetch composer && git fetch --tags composer"); $expectedGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref'^{commit} || (git fetch composer && git fetch --tags composer)");
$packageMock = $this->getMock('Composer\Package\PackageInterface'); $packageMock = $this->getMock('Composer\Package\PackageInterface');
$packageMock->expects($this->any()) $packageMock->expects($this->any())
@ -491,7 +491,7 @@ composer https://github.com/old/url (push)
*/ */
public function testUpdateThrowsRuntimeExceptionIfGitCommandFails() public function testUpdateThrowsRuntimeExceptionIfGitCommandFails()
{ {
$expectedGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git fetch composer && git fetch --tags composer"); $expectedGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref'^{commit} || (git fetch composer && git fetch --tags composer)");
$packageMock = $this->getMock('Composer\Package\PackageInterface'); $packageMock = $this->getMock('Composer\Package\PackageInterface');
$packageMock->expects($this->any()) $packageMock->expects($this->any())
@ -529,8 +529,8 @@ composer https://github.com/old/url (push)
public function testUpdateDoesntThrowsRuntimeExceptionIfGitCommandFailsAtFirstButIsAbleToRecover() public function testUpdateDoesntThrowsRuntimeExceptionIfGitCommandFailsAtFirstButIsAbleToRecover()
{ {
$expectedFirstGitUpdateCommand = $this->winCompat("git remote set-url composer '' && git fetch composer && git fetch --tags composer"); $expectedFirstGitUpdateCommand = $this->winCompat("git remote set-url composer '' && git rev-parse --quiet --verify 'ref'^{commit} || (git fetch composer && git fetch --tags composer)");
$expectedSecondGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git fetch composer && git fetch --tags composer"); $expectedSecondGitUpdateCommand = $this->winCompat("git remote set-url composer 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref'^{commit} || (git fetch composer && git fetch --tags composer)");
$packageMock = $this->getMock('Composer\Package\PackageInterface'); $packageMock = $this->getMock('Composer\Package\PackageInterface');
$packageMock->expects($this->any()) $packageMock->expects($this->any())