From 742a88a842d380278b6526ac3a090e940dbf7ea7 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Fri, 20 Sep 2024 15:02:00 +0200
Subject: [PATCH] build(): check if checkout of sources failed

---
 public_html/deployment/classes/project.class.php | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php
index d919f42a..bd67b5ef 100644
--- a/public_html/deployment/classes/project.class.php
+++ b/public_html/deployment/classes/project.class.php
@@ -27,6 +27,7 @@ require_once 'htmlguielements.class.php';
   2013-11-08  Axel <axel.hahn@iml.unibe.ch>
   (...)
   2024-08-28  Axel   php8 only; added variable types; short array syntax
+  2024-09-20  Axel   build(): check if checkout of sources failed
   ###################################################################### */
 
 /**
@@ -1787,7 +1788,14 @@ class project extends base
 
         $sCheckout=$this->_oVcs->getSources($sTempBuildDir);
         $sReturn .= '<pre>' . $sCheckout . '</pre>';
-        return false;
+
+        // fetch last line "rc=NNN"
+        preg_match("/rc=([0-9]+)$/", $sCheckout, $aMatches);
+        $iRc=$aMatches[1] ?? 0;
+        if ($iRc != 0) {
+            return $this->_oHtml->getBox("error", "" . $sReturn);
+        }
+
 
         $aRepodata = $this->getRepoRevision();
         $sRevisionShort = substr($aRepodata['revision'], 0, 8);
-- 
GitLab