From 20c5dece8b8028d1849319c211ed5589aa045d95 Mon Sep 17 00:00:00 2001
From: hahn <axel.hahn@iml.unibe.ch>
Date: Fri, 29 Jul 2022 21:30:13 +0200
Subject: [PATCH] update git::getRevision

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

diff --git a/public_html/deployment/classes/vcs.git.class.php b/public_html/deployment/classes/vcs.git.class.php
index a7b35edb..b87e8c51 100644
--- a/public_html/deployment/classes/vcs.git.class.php
+++ b/public_html/deployment/classes/vcs.git.class.php
@@ -120,7 +120,9 @@ class vcs implements iVcs {
             $sGitCmd.='git remote add origin "' . $this->getUrl() . '" 2>&1 ';
             // $sGitCmd='time ('.$sGitCmd.')';
             // exec($sGitCmd, $aOutput, $iRc);
-            exec($sGitCmd);
+            $this->log(__FUNCTION__." start command <code>$sGitCmd</code>");
+            exec($sGitCmd, $aOutput,$iRc);
+            $this->log(__FUNCTION__." command ended with rc=$iRc ". '<pre>'.implode("\n", $aOutput).'</pre>', ($iRc==0 ? 'info':'error'));
         }
         return $this->_sTempDir;
     }
@@ -408,6 +410,14 @@ class vcs implements iVcs {
         }
 
         $sGitCmd = 'export GIT_SSH="' . $this->_sWrapper . '" ; export PKEY="' . $this->_sKeyfile . '" ; ';
+
+        // Luki:
+        // git clone -b <branch_or_tag> --single-branch <repo_url> --depth 1 --bare <dir>
+        /*
+        $sWorkDir=$sWorkDir ? $sWorkDir : $this->_sTempDir;
+        $sWorkDir='/dev/shm/abc';
+        $sGitCmd.='git clone -b '.$this->_sCurrentBranch.' --single-branch '.$this->getUrl().' --depth 1 --bare "' . $sWorkDir . '" 2>&1; rm -rf "' . $sWorkDir . '"';
+        */
         if ($sWorkDir) {
             $sGitCmd.='cd "' . $sWorkDir . '" && ';
         } else {
@@ -422,7 +432,7 @@ class vcs implements iVcs {
             // TODO: git 1.9 does needs only the line with --tags
             $sGitCmd.=' ( '
                     . 'git fetch --update-head-ok --tags --depth 1 2>&1 ; ' // 1.5 s
-                    . 'git fetch --update-head-ok --depth 1 2>&1 '          // 1.5 s
+                    //. 'git fetch --update-head-ok --depth 1 2>&1 '          // 1.5 s
                     . ') && ';
         }
 
-- 
GitLab