diff --git a/project.hxp b/project.hxp index c06bfb6e3..3c73b515f 100644 --- a/project.hxp +++ b/project.hxp @@ -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; } // diff --git a/source/funkin/util/macro/GitCommit.hx b/source/funkin/util/macro/GitCommit.hx index b1163e59b..a29a7eb00 100644 --- a/source/funkin/util/macro/GitCommit.hx +++ b/source/funkin/util/macro/GitCommit.hx @@ -71,38 +71,9 @@ class GitCommit public static macro function getGitHasLocalChanges():haxe.macro.Expr.ExprOf { #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};