Merge pull request #3853 from hakre/fix/git-checkout
Git Checkout Branch / File Differentiationpull/3899/merge
commit
e50b5fe990
|
@ -215,7 +215,7 @@ class GitDownloader extends VcsDownloader
|
|||
*/
|
||||
protected function updateToCommit($path, $reference, $branch, $date)
|
||||
{
|
||||
$template = 'git checkout %s && git reset --hard %1$s';
|
||||
$template = 'git checkout %s -- && git reset --hard %1$s';
|
||||
$branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
|
||||
|
||||
$branches = null;
|
||||
|
@ -242,7 +242,7 @@ class GitDownloader extends VcsDownloader
|
|||
$branch = 'v' . $branch;
|
||||
}
|
||||
|
||||
$command = sprintf('git checkout %s', ProcessExecutor::escape($branch));
|
||||
$command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
|
||||
$fallbackCommand = sprintf('git checkout -B %s %s', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
|
||||
if (0 === $this->process->execute($command, $output, $path)
|
||||
|| 0 === $this->process->execute($fallbackCommand, $output, $path)
|
||||
|
|
|
@ -74,7 +74,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$processExecutor->expects($this->at(2))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat("git checkout 'master'")), $this->equalTo(null), $this->equalTo($this->winCompat('composerPath')))
|
||||
->with($this->equalTo($this->winCompat("git checkout 'master' --")), $this->equalTo(null), $this->equalTo($this->winCompat('composerPath')))
|
||||
->will($this->returnValue(0));
|
||||
|
||||
$processExecutor->expects($this->at(3))
|
||||
|
@ -134,7 +134,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$processExecutor->expects($this->at(6))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat("git checkout 'ref' && git reset --hard 'ref'")), $this->equalTo(null), $this->equalTo($this->winCompat('composerPath')))
|
||||
->with($this->equalTo($this->winCompat("git checkout 'ref' -- && git reset --hard 'ref'")), $this->equalTo(null), $this->equalTo($this->winCompat('composerPath')))
|
||||
->will($this->returnValue(0));
|
||||
|
||||
$downloader = $this->getDownloaderMock(null, new Config(), $processExecutor);
|
||||
|
@ -266,7 +266,7 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
|||
->will($this->returnValue(0));
|
||||
$processExecutor->expects($this->at(4))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat("git checkout 'ref' && git reset --hard 'ref'")), $this->equalTo(null), $this->equalTo($this->winCompat($tmpDir)))
|
||||
->with($this->equalTo($this->winCompat("git checkout 'ref' -- && git reset --hard 'ref'")), $this->equalTo(null), $this->equalTo($this->winCompat($tmpDir)))
|
||||
->will($this->returnValue(0));
|
||||
|
||||
$downloader = $this->getDownloaderMock(null, new Config(), $processExecutor);
|
||||
|
|
Loading…
Reference in New Issue