From 1cdae66f8fe0a1f2e5166f5d55ba35b7b2898e30 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 4 Apr 2012 09:09:27 +0200 Subject: [PATCH] Fix up git downloader and git driver commands --- src/Composer/Downloader/GitDownloader.php | 2 +- src/Composer/Repository/Vcs/GitDriver.php | 2 +- tests/Composer/Test/Downloader/GitDownloaderTest.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index 39fd3f71a..ea8baabc5 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -45,7 +45,7 @@ class GitDownloader extends VcsDownloader $ref = escapeshellarg($target->getSourceReference()); $path = escapeshellarg($path); $this->io->write(" Checking out ".$target->getSourceReference()); - $command = 'cd %s && git remote set-url origin %s && git fetch --tags origin && git checkout %3$s && git reset --hard %3$s'; + $command = 'cd %s && git remote set-url origin %s && git fetch origin && git fetch --tags origin && git checkout %3$s && git reset --hard %3$s'; $commandCallable = function($url) use ($ref, $path, $command) { return sprintf($command, $path, $url, $ref); diff --git a/src/Composer/Repository/Vcs/GitDriver.php b/src/Composer/Repository/Vcs/GitDriver.php index d3dd99e10..ff99218cd 100644 --- a/src/Composer/Repository/Vcs/GitDriver.php +++ b/src/Composer/Repository/Vcs/GitDriver.php @@ -45,7 +45,7 @@ class GitDriver extends VcsDriver // update the repo if it is a valid git repository if (is_dir($this->repoDir) && 0 === $this->process->execute('git remote', $output, $this->repoDir)) { - $this->process->execute('git remote update', $output, $this->repoDir); + $this->process->execute('git remote update --prune origin', $output, $this->repoDir); } else { // clean up directory and do a fresh clone into it $fs = new Filesystem(); diff --git a/tests/Composer/Test/Downloader/GitDownloaderTest.php b/tests/Composer/Test/Downloader/GitDownloaderTest.php index d392e3db6..2c8767b84 100644 --- a/tests/Composer/Test/Downloader/GitDownloaderTest.php +++ b/tests/Composer/Test/Downloader/GitDownloaderTest.php @@ -139,7 +139,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase public function testUpdate() { - $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'"); + $expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url origin 'git://github.com/composer/composer' && git fetch origin && git fetch --tags origin && git checkout 'ref' && git reset --hard 'ref'"); $expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain"); $packageMock = $this->getMock('Composer\Package\PackageInterface'); @@ -168,7 +168,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase */ public function testUpdateThrowsRuntimeExceptionIfGitCommandFails() { - $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'"); + $expectedGitUpdateCommand = $this->getCmd("cd 'composerPath' && git remote set-url origin 'git://github.com/composer/composer' && git fetch origin && git fetch --tags origin && git checkout 'ref' && git reset --hard 'ref'"); $expectedGitResetCommand = $this->getCmd("cd 'composerPath' && git status --porcelain"); $packageMock = $this->getMock('Composer\Package\PackageInterface');