From e6ef498db4bbda34bc84b7b85e036fcdce489b68 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Mon, 24 Feb 2014 20:34:31 +0000 Subject: [PATCH] Adding support for HTTP commit-based builds too --- PHPCI/Model/Build/RemoteGitBuild.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PHPCI/Model/Build/RemoteGitBuild.php b/PHPCI/Model/Build/RemoteGitBuild.php index 075eb7da..4be161bd 100644 --- a/PHPCI/Model/Build/RemoteGitBuild.php +++ b/PHPCI/Model/Build/RemoteGitBuild.php @@ -64,7 +64,9 @@ class RemoteGitBuild extends Build */ protected function cloneByHttp(Builder $builder, $cloneTo) { - return $builder->executeCommand('git clone -b %s %s "%s"', $this->getBranch(), $this->getCloneUrl(), $cloneTo); + $success = $builder->executeCommand('git clone -b %s %s "%s"', $this->getBranch(), $this->getCloneUrl(), $cloneTo); + $builder->executeCommand('cd "%s" && git checkout %s', $cloneTo, $this->getCommitId()); + return $success; } /** @@ -88,7 +90,7 @@ class RemoteGitBuild extends Build $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);