Make sure we fetch origin with tags before checking out a new version
parent
66be50ce71
commit
afa14124f3
|
@ -45,7 +45,7 @@ class GitDownloader extends VcsDownloader
|
||||||
$ref = escapeshellarg($target->getSourceReference());
|
$ref = escapeshellarg($target->getSourceReference());
|
||||||
$path = escapeshellarg($path);
|
$path = escapeshellarg($path);
|
||||||
$this->io->write(" Checking out ".$target->getSourceReference());
|
$this->io->write(" Checking out ".$target->getSourceReference());
|
||||||
$command = 'cd %s && git remote set-url origin %s && git fetch && git checkout %3$s && git reset --hard %3$s';
|
$command = 'cd %s && git remote set-url origin %s && git fetch --tags origin && git checkout %3$s && git reset --hard %3$s';
|
||||||
|
|
||||||
$commandCallable = function($url) use ($ref, $path, $command) {
|
$commandCallable = function($url) use ($ref, $path, $command) {
|
||||||
return sprintf($command, $path, $url, $ref);
|
return sprintf($command, $path, $url, $ref);
|
||||||
|
|
|
@ -89,7 +89,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
->with($this->equalTo($expectedGitCommand))
|
->with($this->equalTo($expectedGitCommand))
|
||||||
->will($this->returnValue(0));
|
->will($this->returnValue(0));
|
||||||
|
|
||||||
$expectedGitCommand = $this->getCmd("cd 'composerPath' && git remote set-url --push origin 'git@github.com:composer/composer.git'");
|
$expectedGitCommand = $this->getCmd("git remote set-url --push origin 'git@github.com:composer/composer.git'");
|
||||||
$processExecutor->expects($this->at(3))
|
$processExecutor->expects($this->at(3))
|
||||||
->method('execute')
|
->method('execute')
|
||||||
->with($this->equalTo($expectedGitCommand))
|
->with($this->equalTo($expectedGitCommand))
|
||||||
|
@ -139,7 +139,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testUpdate()
|
public function testUpdate()
|
||||||
{
|
{
|
||||||
$expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url origin 'git://github.com/composer/composer' && git fetch && git checkout 'ref' && git reset --hard 'ref'");
|
$expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url origin 'git://github.com/composer/composer' && git fetch --tags origin && git checkout 'ref' && git reset --hard 'ref'");
|
||||||
$expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain");
|
$expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain");
|
||||||
|
|
||||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||||
|
@ -168,7 +168,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testUpdateThrowsRuntimeExceptionIfGitCommandFails()
|
public function testUpdateThrowsRuntimeExceptionIfGitCommandFails()
|
||||||
{
|
{
|
||||||
$expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url origin 'git://github.com/composer/composer' && git fetch && git checkout 'ref' && git reset --hard 'ref'");
|
$expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url origin 'git://github.com/composer/composer' && git fetch --tags origin && git checkout 'ref' && git reset --hard 'ref'");
|
||||||
$expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain");
|
$expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain");
|
||||||
|
|
||||||
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
$packageMock = $this->getMock('Composer\Package\PackageInterface');
|
||||||
|
|
Loading…
Reference in New Issue