Fixed bug in commit hash detection when output ends with newline

This commit is contained in:
Dylan K. Taylor 2018-05-03 16:37:05 +01:00
parent 295016cbc1
commit 723251e800

View File

@ -271,7 +271,7 @@ namespace pocketmine {
$gitHash = str_repeat("00", 20);
if(\Phar::running(true) === ""){
if(Utils::execute("git rev-parse HEAD", $out) === 0 and $out !== false and strlen($out) === 40){
if(Utils::execute("git rev-parse HEAD", $out) === 0 and $out !== false and strlen($out = trim($out)) === 40){
$gitHash = trim($out);
if(Utils::execute("git diff --quiet") === 1 or Utils::execute("git diff --cached --quiet") === 1){ //Locally-modified
$gitHash .= "-dirty";