diff --git a/PHPCI/Helper/Diff.php b/PHPCI/Helper/Diff.php index e50c7eaf..5dcb5388 100644 --- a/PHPCI/Helper/Diff.php +++ b/PHPCI/Helper/Diff.php @@ -26,11 +26,15 @@ class Diff */ public function getLinePositions($diff) { + if (empty($diff)) { + return null; + } + $rtn = array(); $diffLines = explode(PHP_EOL, $diff); - while (1) { + while (count($diffLines)) { $line = array_shift($diffLines); if (substr($line, 0, 2) == '@@') { diff --git a/PHPCI/Model/Build/GithubBuild.php b/PHPCI/Model/Build/GithubBuild.php index 1482f1c0..4d61b9d6 100644 --- a/PHPCI/Model/Build/GithubBuild.php +++ b/PHPCI/Model/Build/GithubBuild.php @@ -211,7 +211,7 @@ class GithubBuild extends RemoteGitBuild } else { $commitId = $this->getCommitId(); $compare = $commitId == 'Manual' ? 'HEAD' : $commitId; - $builder->executeCommand('cd %s && git diff %s^! "%s"', $path, $compare, $file); + $builder->executeCommand('cd %s && git diff %s^^ "%s"', $path, $compare, $file); } $builder->logExecOutput(true);