Added update committer email after clone for Git builds.

This commit is contained in:
Dmitry Khomutov 2017-12-27 22:38:58 +07:00
parent 2669440167
commit dc79c499f4
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
2 changed files with 15 additions and 7 deletions

View file

@ -7,7 +7,7 @@ use PHPCensor\Builder;
/**
* Mercurial Build Model
*
*
* @author Pavel Gopanenko <pavelgopanenko@gmail.com>
*/
class MercurialBuild extends Build
@ -78,9 +78,11 @@ class MercurialBuild extends Build
/**
* Handle post-clone tasks (switching branch, etc.)
*
* @param Builder $builder
* @param $cloneTo
* @param array $extra
* @param string $cloneTo
* @param array $extra
*
* @return bool
*/
protected function postCloneSetup(Builder $builder, $cloneTo, array $extra = null)

View file

@ -8,7 +8,7 @@ use Psr\Log\LogLevel;
/**
* Remote Git Build Model
*
*
* @author Dan Cryer <dan@block8.co.uk>
*/
class RemoteGitBuild extends Build
@ -130,9 +130,11 @@ class RemoteGitBuild extends Build
/**
* Handle any post-clone tasks, like switching branches.
*
* @param Builder $builder
* @param $cloneTo
* @param array $extra
* @param string $cloneTo
* @param array $extra
*
* @return bool
*/
protected function postCloneSetup(Builder $builder, $cloneTo, array $extra = null)
@ -147,7 +149,7 @@ class RemoteGitBuild extends Build
}
// Always update the commit hash with the actual HEAD hash
if ($builder->executeCommand($chdir . ' && git rev-parse HEAD', $cloneTo)) {
if ($builder->executeCommand($chdir . ' && git rev-parse HEAD', $cloneTo)) {
$commitId = trim($builder->getLastOutput());
$this->setCommitId($commitId);
@ -155,6 +157,10 @@ class RemoteGitBuild extends Build
if ($builder->executeCommand($chdir . ' && git log -1 --pretty=format:%%s %s', $cloneTo, $commitId)) {
$this->setCommitMessage(trim($builder->getLastOutput()));
}
if ($builder->executeCommand($chdir . ' && git log -1 --pretty=format:%%ae %s', $cloneTo, $commitId)) {
$this->setCommitterEmail(trim($builder->getLastOutput()));
}
}
return $success;