From a798d6aa1b2c88593547835d6d7a6b2ea6d7f21e Mon Sep 17 00:00:00 2001
From: hahn <axel.hahn@iml.unibe.ch>
Date: Tue, 27 Feb 2018 17:05:18 +0100
Subject: [PATCH] task#1847 - smail fixes: - getRevision writes git output to
 log (requires enabled debugging to see it) - added check for tmpdir

---
 public_html/check-config.php                     |  1 +
 public_html/deployment/classes/vcs.git.class.php | 11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/public_html/check-config.php b/public_html/check-config.php
index f73d7ec9..ee675a30 100644
--- a/public_html/check-config.php
+++ b/public_html/check-config.php
@@ -160,6 +160,7 @@ if (!isset($aConfig) || !is_array($aConfig)) {
         'buildDefaultsDir',
         'packageDir',
         'archiveDir',
+        'tmpDir',
     ) as $sKey) {
         checkdir($aConfig[$sKey], $sKey);
     }
diff --git a/public_html/deployment/classes/vcs.git.class.php b/public_html/deployment/classes/vcs.git.class.php
index 0a4fad78..481a01da 100644
--- a/public_html/deployment/classes/vcs.git.class.php
+++ b/public_html/deployment/classes/vcs.git.class.php
@@ -261,6 +261,8 @@ class vcs implements iVcs {
                 }
                 $this->_aRemoteBranches = $aReturn;
                 $oCache->write($aReturn, $iTtl);
+            } else {
+            $this->log(__FUNCTION__." FAILD with rc=$iRc $sGitCmd", 'error');
             }
         } else {
             $this->_aRemoteBranches = $oCache->read();
@@ -360,6 +362,8 @@ class vcs implements iVcs {
     public function getRevision($sWorkDir = false) {
         $this->log(__FUNCTION__." start");
         $aReturn = array();
+        $aOutput=array();
+        $iRc=false;
         if (!$this->getUrl()) {
             return false;
         }
@@ -385,8 +389,11 @@ class vcs implements iVcs {
 
         $sGitCmd.='git log -1 "' . $this->_sCurrentBranch . '" 2>&1 ; '; // 0.0 s
         $this->log(__FUNCTION__." start command $sGitCmd");
-        $sLoginfo = shell_exec($sGitCmd);
-        $this->log(__FUNCTION__." end command $sGitCmd");
+        // $sLoginfo = shell_exec($sGitCmd);
+        exec($sGitCmd, $aOutput, $iRc);
+        $sLoginfo= implode("\n", $aOutput);
+        $this->log(__FUNCTION__." end with rc=$iRc <pre>$sLoginfo</pre>", ($iRc==0 ? 'info':'error'));
+        
         /*
          * 
          * example output:
-- 
GitLab