Added git information to system info for telling what git commit a submission is for

This commit is contained in:
Matthew Barbour 2020-06-11 16:52:21 -05:00 committed by Shish
parent 4d0b90921d
commit b2405166b3

View file

@ -98,6 +98,20 @@ class ET extends Extension
],
];
if (file_exists(".git")) {
try {
$commitHash = trim(exec('git log --pretty="%h" -n1 HEAD'));
$commitBranch= trim(exec('git rev-parse --abbrev-ref HEAD'));
$commitOrigin= trim(exec('git config --get remote.origin.url'));
$info['git'] = [
'commit' => $commitHash,
'branch' => $commitBranch,
'origin' => $commitOrigin,
];
} catch (Exception $e) {
}
}
return $info;
}