Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure Git SHA is for the Flixel repository #3322

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions flixel/system/macros/FlxGitSHA.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package flixel.system.macros;

import haxe.io.Path;
import haxe.macro.Context;
import haxe.macro.Expr;
import sys.io.Process;
Expand Down Expand Up @@ -58,17 +59,19 @@ class FlxGitSHA
}
}

return result;
return Path.normalize(result);
}

public static function getGitSHA(path:String):String
{
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);
Expand Down Expand Up @@ -96,4 +99,4 @@ class FlxGitSHA
return "";
}
}
}
}
Loading