Handle remote repos better

This commit is contained in:
int2001
2024-03-25 06:30:16 +00:00
parent 85390dc268
commit e1c9de18aa
2 changed files with 4 additions and 6 deletions

View File

@@ -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']='';