From e5aa246a27644faa2df9eab15550934d3b6d03f7 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Tue, 14 Jan 2020 13:17:18 +0100 Subject: [PATCH] fix(robo): prevent exception when computong log with commit without body Signed-off-by: Thierry Bugier --- RoboFile.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index 1b653ef42..4f5dc3083 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -771,9 +771,6 @@ public static function getFileFromGit($path, $rev) { public static function getCommitBody($hash) { $output = shell_exec("git log $hash --max-count=1 --pretty=format:\"%b\""); - if ($output === null) { - throw new Exception ("could not get commit body"); - } return $output; } @@ -825,10 +822,10 @@ public static function compareCommits($a, $b) { return 1; } - // then compare message - if ($a->message < $b->message) { + // then compare subject + if ($a->subject < $b->subject) { return -1; - } else if ($a->message > $b->message) { + } else if ($a->subject > $b->subject) { return 1; } @@ -977,7 +974,7 @@ public static function buildLogLine($commit, $remote) { } $hash = $commit->hash; $line .= " $commit->subject" - . "([$hash]($remote/commit/$hash))"; + . " ([$hash]($remote/commit/$hash))"; // Search for closed issues $body = explode(PHP_EOL, $commit->body);