Fix hang caused by git status.

This commit is contained in:
MAJigsaw77
2025-10-08 04:24:24 -05:00
committed by Abnormal
parent 83c2ea2881
commit fddf0e92cb
2 changed files with 4 additions and 60 deletions
+2 -29
View File
@@ -1915,36 +1915,9 @@ class Project extends HXProject
public function getGitModified():Bool
{
var branchProcess = new sys.io.Process('git', ['status', '--porcelain']);
var branchProcess = new sys.io.Process('git', ['diff', '--quiet']);
if (branchProcess.exitCode() != 0)
{
var message = branchProcess.stderr.readAll().toString();
error('Could not determine current git status; is this a proper Git repository?');
}
var output:String = '';
try
{
output = branchProcess.stdout.readLine();
}
catch (e)
{
if (e.message == 'Eof')
{
// Do nothing.
// Eof = No output.
}
else
{
// Rethrow other exceptions.
throw e;
}
}
branchProcess.close();
return output.length > 0;
return branchProcess.exitCode(true) == 1;
}
//
+2 -31
View File
@@ -71,38 +71,9 @@ class GitCommit
public static macro function getGitHasLocalChanges():haxe.macro.Expr.ExprOf<Bool>
{
#if !display
// Get the current line number.
var pos = haxe.macro.Context.currentPos();
var branchProcess = new sys.io.Process('git', ['status', '--porcelain']);
var branchProcess = new sys.io.Process('git', ['diff', '--quiet']);
if (branchProcess.exitCode() != 0)
{
var message = branchProcess.stderr.readAll().toString();
haxe.macro.Context.info('[WARN] Could not determine current git commit; is this a proper Git repository?', pos);
}
var output:String = '';
try
{
output = branchProcess.stdout.readLine();
branchProcess.close();
}
catch (e)
{
if (e.message == 'Eof')
{
// Do nothing.
// Eof = No output.
}
else
{
// Rethrow other exceptions.
throw e;
}
}
// Generates a string expression
return macro $v{output.length > 0};
return macro $v{branchProcess.exitCode(true) == 1};
#else
// `#if display` is used for code completion. In this case we just assume true.
return macro $v{true};