22declare(strict_types=1);
26use
function str_repeat;
32 private function __construct(){
42 if(
Process::execute(
"git -C \"$dir\" rev-parse HEAD", $out) === 0 && $out !== false && strlen($out = trim($out)) === 40){
57 $detectedHash = self::getRepositoryState($dir, $dirty);
58 if($detectedHash !==
null){
59 return $detectedHash . ($dirty ?
"-dirty" :
"");
61 return str_repeat(
"00", 20);
static getRepositoryStatePretty(string $dir)
static getRepositoryState(string $dir, bool &$dirty)
static execute(string $command, ?string &$stdout=null, ?string &$stderr=null)