diff --git a/flixel/system/macros/FlxGitSHA.hx b/flixel/system/macros/FlxGitSHA.hx index 7c5c664c3..8e58d6cc5 100644 --- a/flixel/system/macros/FlxGitSHA.hx +++ b/flixel/system/macros/FlxGitSHA.hx @@ -1,5 +1,6 @@ package flixel.system.macros; +import haxe.io.Path; import haxe.macro.Context; import haxe.macro.Expr; import sys.io.Process; @@ -58,7 +59,7 @@ class FlxGitSHA } } - return result; + return Path.normalize(result); } public static function getGitSHA(path:String):String @@ -66,9 +67,11 @@ class FlxGitSHA var oldWd = Sys.getCwd(); Sys.setCwd(path); - var sha = getProcessOutput("git", ["rev-parse", "HEAD"]); + var output = getProcessOutput("git", ["rev-parse", "HEAD", "--show-toplevel"]).split("\n"); + var sha = output[0]; + var gitPath = Path.normalize(output[1]); var shaRegex = ~/[a-f0-9]{40}/g; - if (!shaRegex.match(sha)) + if (!shaRegex.match(sha) || path != gitPath) sha = ""; Sys.setCwd(oldWd); @@ -96,4 +99,4 @@ class FlxGitSHA return ""; } } -} \ No newline at end of file +}