From 7b8fa0eb01167bf02d625361c680732d9a8dd042 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Wed, 23 Apr 2025 16:08:01 +0200 Subject: [PATCH] vcs git: do not return boolean false but array with key error --- public_html/deployment/classes/vcs.git.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public_html/deployment/classes/vcs.git.class.php b/public_html/deployment/classes/vcs.git.class.php index 9302e88f..074576cd 100644 --- a/public_html/deployment/classes/vcs.git.class.php +++ b/public_html/deployment/classes/vcs.git.class.php @@ -404,16 +404,19 @@ class vcs implements iVcs /** * Get current revision and commit message from remote repository * @see $this::getRevision - * It returns false if no branch is set + * It returns a key "error" if no branch is set * * @param boolean $bRefresh optional: refresh data; default: use cache - * @return bool|array + * @return array */ - public function getRepoRevision(bool $bRefresh = false): bool|array + public function getRepoRevision(bool $bRefresh = false): array { $this->log(__FUNCTION__ . "($bRefresh) start"); if (!$this->_sCurrentBranch) { - return false; + return [ + "error" => "Error: Current git branch was not detected.", + ]; + // return false; } $sMessage = $this->getCommitmessageByBranch(false, $bRefresh ? 'dummy_to_force_refresh' : false); if ($sMessage) { -- GitLab