From a58dcbe7668dd8ebe7a5b39391d1203cfd96388b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Huet?= Date: Sat, 13 Dec 2014 15:14:43 +0100 Subject: [PATCH] git local commands should be executed in the deployment:from directory --- Mage/Task/BuiltIn/Scm/ChangeBranchTask.php | 5 +++-- Mage/Task/BuiltIn/Scm/UpdateTask.php | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php b/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php index 8c5e33f..20859c5 100644 --- a/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php +++ b/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php @@ -63,14 +63,15 @@ class ChangeBranchTask extends AbstractTask */ public function run() { + $preCommand = 'cd ' . $this->getConfig()->deployment('from', './') . '; '; switch ($this->getConfig()->general('scm')) { case 'git': if ($this->getParameter('_changeBranchRevert', false)) { - $command = 'git checkout ' . self::$startingBranch; + $command = $preCommand . 'git checkout ' . self::$startingBranch; $result = $this->runCommandLocal($command); } else { - $command = 'git branch | grep \'*\' | cut -d\' \' -f 2'; + $command = $preCommand . 'git branch | grep \'*\' | cut -d\' \' -f 2'; $currentBranch = 'master'; $result = $this->runCommandLocal($command, $currentBranch); diff --git a/Mage/Task/BuiltIn/Scm/UpdateTask.php b/Mage/Task/BuiltIn/Scm/UpdateTask.php index 22c496e..3347a97 100644 --- a/Mage/Task/BuiltIn/Scm/UpdateTask.php +++ b/Mage/Task/BuiltIn/Scm/UpdateTask.php @@ -54,9 +54,10 @@ class UpdateTask extends AbstractTask */ public function run() { + $command = 'cd ' . $this->getConfig()->deployment('from', './') . '; '; switch ($this->getConfig()->general('scm')) { case 'git': - $command = 'git pull'; + $command .= 'git pull'; break; default: