/** * Stash the current changes, only if there have been uncommitted changes */ protected function stash() { if ($this->getGit()->hasChanges()) { // If we have changes, we stash them to restore state when we're done $os = new OperationState(); $os->setExecute(array($this->getGit(), 'run'), array('stash')); $os->setUndo(array($this, 'unstash'), OperationState::NO_ARGUMENT); $this->getOsm()->add($os); // TODO: log $this->getOsm()->execute($os); $this->setStashStack($this->getStashStack() + 1); } }