mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
Fixed rollback bug in GitPreparer
Added a guard to GitPreparer::unsetVcsInProgress() to prevent doing a
`git reset` when there are no test locks present.
Otherwise, the uncommitted changes in the app will be removed by the
shutdown feature introduced in 952c6e5890
.
This commit is contained in:
@@ -7,11 +7,13 @@ class GitPreparer implements Preparer
|
|||||||
|
|
||||||
public function snapshot()
|
public function snapshot()
|
||||||
{
|
{
|
||||||
|
$this->debug('Snapshot requested');
|
||||||
return $this->setVcsInProgress();
|
return $this->setVcsInProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rollback()
|
public function rollback()
|
||||||
{
|
{
|
||||||
|
$this->debug('Rollback requested');
|
||||||
return $this->unsetVcsInProgress();
|
return $this->unsetVcsInProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +90,12 @@ class GitPreparer implements Preparer
|
|||||||
|
|
||||||
protected function unsetVcsInProgress()
|
protected function unsetVcsInProgress()
|
||||||
{
|
{
|
||||||
|
if (!$this->isVcsInProgress())
|
||||||
|
{
|
||||||
|
$this->debug('No test locks found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->debug('Rolling back Git repo to pre-test state…');
|
$this->debug('Rolling back Git repo to pre-test state…');
|
||||||
$this->runCommand('git reset --hard HEAD');
|
$this->runCommand('git reset --hard HEAD');
|
||||||
$this->runCommand('git clean -fdx');
|
$this->runCommand('git clean -fdx');
|
||||||
|
Reference in New Issue
Block a user