From e1c9de18aacacece54e89b95f270f7dd818fa0bb Mon Sep 17 00:00:00 2001 From: int2001 Date: Mon, 25 Mar 2024 06:30:16 +0000 Subject: [PATCH] Handle remote repos better --- application/controllers/Debug.php | 4 +--- application/views/debug/index.php | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/application/controllers/Debug.php b/application/controllers/Debug.php index b5cc329dc..e35d46cd8 100644 --- a/application/controllers/Debug.php +++ b/application/controllers/Debug.php @@ -170,9 +170,7 @@ class Debug extends CI_Controller $a_versions=[]; try { $st=exec('git fetch'); - $line = trim(exec('git log -n 1 --pretty=%D HEAD')); // Get local branch-descriptor - $pieces = explode(', ', $line); - $versions['branch'] = substr($pieces[1], strpos($pieces[1], '/') + 1); + $versions['branch'] = trim(exec('git rev-parse --abbrev-ref HEAD')); // Get ONLY Name of the Branch we're on $versions['latest_commit_hash']=substr(trim(exec('git log --pretty="%H" -n1 HEAD..origin'.'/'.$versions['branch'])),0,8); // fetch latest commit-hash from repo } catch (Exception $e) { $versions['latest_commit_hash']=''; diff --git a/application/views/debug/index.php b/application/views/debug/index.php index d3ed562af..8f7c2e8de 100644 --- a/application/views/debug/index.php +++ b/application/views/debug/index.php @@ -208,7 +208,7 @@ var local_branch = 'n/a'; - \ No newline at end of file +