From eaec8e1beac098d897c8d27ccc5106204dc371f0 Mon Sep 17 00:00:00 2001 From: fieg Date: Thu, 31 Oct 2013 09:59:10 +0100 Subject: [PATCH] added branch to git pull call --- src/Webcreate/Vcs/Git.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/Webcreate/Vcs/Git.php b/src/Webcreate/Vcs/Git.php index 102f8fa..a338495 100644 --- a/src/Webcreate/Vcs/Git.php +++ b/src/Webcreate/Vcs/Git.php @@ -79,7 +79,7 @@ public function checkout($dest = null) $head = $this->getHead(); $branch = $head->getName(); - $this->dispatch(VcsEvents::PRE_CHECKOUT, array('dest' => $realdest, 'head' => $head->getName())); + $this->dispatch(VcsEvents::PRE_CHECKOUT, array('dest' => $realdest, 'head' => $branch)); if (false === $this->hasClone || false === is_null($dest)) { $this->cloneRepository($dest); @@ -89,7 +89,7 @@ public function checkout($dest = null) $this->hasCheckout = true; - $result = $this->pull(); + $result = $this->pull('origin', $branch); $this->dispatch(VcsEvents::POST_CHECKOUT); } @@ -173,13 +173,6 @@ public function export($path, $dest) $this->dispatch(VcsEvents::PRE_EXPORT); if (!$this->hasCheckout) { -// if ($this->isTemporary) { -// // create a shallow checkout -// $result = $this->execute('clone', array('-b' => (string) $branch, '--depth=1', $this->url, $dest)); -// } else { -// $this->checkout(); -// } - $this->checkout(); } @@ -188,8 +181,6 @@ public function export($path, $dest) $result = $this->adapter->execute('submodule', array('update', '--init' => true, '--recursive' => true), $dest); - //$this->isTemporary = false; - $filesystem = new Filesystem(); $filesystem->remove($dest . '/.git'); @@ -396,16 +387,17 @@ public function push($remote = 'origin') * Git pull * * @param string $remote + * @param string $branch * @throws \RuntimeException * @return string */ - public function pull($remote = 'origin') + public function pull($remote = 'origin', $branch = 'master') { if (!$this->hasCheckout) { throw new \RuntimeException('This operation requires an active checkout.'); } - return $this->execute('pull', array($remote)); + return $this->execute('pull', array($remote, $branch)); } /**