From 43ecd57775b42c01a94606e6f9c31075967d36bd Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Mon, 24 Feb 2014 20:28:18 +0000 Subject: [PATCH] Adding support for building specific revisions, rather than just branches --- PHPCI/Model/Build/RemoteGitBuild.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PHPCI/Model/Build/RemoteGitBuild.php b/PHPCI/Model/Build/RemoteGitBuild.php index c4b03d2c..075eb7da 100644 --- a/PHPCI/Model/Build/RemoteGitBuild.php +++ b/PHPCI/Model/Build/RemoteGitBuild.php @@ -35,8 +35,7 @@ class RemoteGitBuild extends Build public function createWorkingCopy(Builder $builder, $buildPath) { $yamlParser = new YamlParser(); - $success = true; - $key = trim($this->getProject()->getGitKey()); + $key = trim($this->getProject()->getGitKey()); if (!empty($key)) { $success = $this->cloneBySsh($builder, $buildPath); @@ -88,6 +87,7 @@ class RemoteGitBuild extends Build // Use the key file to do an SSH clone: $cmd = 'eval `ssh-agent -s` && ssh-add "%s" && git clone -b %s %s "%s" && ssh-agent -k'; $success = $builder->executeCommand($cmd, $keyFile, $this->getBranch(), $this->getCloneUrl(), $cloneTo); + $builder->executeCommand('cd "%s" && git checkout %s', $cloneTo, $this->getCommitId()); // Remove the key file: unlink($keyFile);