From d0e782ec4e19d66cec804a135949662fa7566392 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Mon, 4 Mar 2024 15:20:45 +0100
Subject: [PATCH] fix reading cached branches

---
 public_html/deployment/classes/vcs.git.class.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/public_html/deployment/classes/vcs.git.class.php b/public_html/deployment/classes/vcs.git.class.php
index 46eb67fd..312f957b 100644
--- a/public_html/deployment/classes/vcs.git.class.php
+++ b/public_html/deployment/classes/vcs.git.class.php
@@ -292,8 +292,6 @@ class vcs implements iVcs {
             $this->log(__FUNCTION__." - command ended with rc=$iRc ". '<pre>'.implode("\n", $aOutput).'</pre>', ($iRc==0 ? 'info':'error'));
             if ($iRc == 0) {
 
-                // use cache that getCommitmessageByBranch can access it
-                $this->_aRemoteBranches = $oCache->read();
                 $this->log(__FUNCTION__ . ' start reading all branches');
                 // $this->log(__FUNCTION__ . ' data from cache: <pre>'.print_r($this->_aRemoteBranches, 1).'</pre>');
                 /**
@@ -343,6 +341,9 @@ class vcs implements iVcs {
                 $oCache->delete();
                 $this->_aRemoteBranches = [];
             }
+        } else {
+            // use cache that getCommitmessageByBranch can access it
+            $this->_aRemoteBranches = $oCache->read();
         }
         return $this->_aRemoteBranches;
     }
-- 
GitLab