Fix hang caused by git status.
This commit is contained in:
+2
-29
@@ -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;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user