mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
ScmRevGen: Set commits ahead to zero when on a tag
This commit is contained in:
@ -6,6 +6,7 @@ var cmd_revision = " rev-parse HEAD";
|
||||
var cmd_describe = " describe --always --long --dirty";
|
||||
var cmd_branch = " rev-parse --abbrev-ref HEAD";
|
||||
var cmd_commits_ahead = " rev-list --count HEAD ^master";
|
||||
var cmd_get_tag = " describe --exact-match HEAD";
|
||||
|
||||
function GetGitExe()
|
||||
{
|
||||
@ -59,6 +60,25 @@ function GetFirstStdOutLine(cmd)
|
||||
}
|
||||
}
|
||||
|
||||
function AttemptToExecuteCommand(cmd)
|
||||
{
|
||||
try
|
||||
{
|
||||
var exec = wshShell.Exec(cmd)
|
||||
|
||||
// wait until the command has finished
|
||||
while (exec.Status == 0) {}
|
||||
|
||||
return exec.ExitCode;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
// catch "the system cannot find the file specified" error
|
||||
WScript.Echo("Failed to exec " + cmd + " this should never happen");
|
||||
WScript.Quit(1);
|
||||
}
|
||||
}
|
||||
|
||||
function GetFileContents(f)
|
||||
{
|
||||
try
|
||||
@ -88,6 +108,12 @@ if (default_update_track == "%DOLPHIN_DEFAULT_UPDATE_TRACK%") default_update_tra
|
||||
// remove hash (and trailing "-0" if needed) from description
|
||||
describe = describe.replace(/(-0)?-[^-]+(-dirty)?$/, '$2');
|
||||
|
||||
// set commits ahead to zero if on a tag
|
||||
if (AttemptToExecuteCommand(gitexe + cmd_get_tag) == 0)
|
||||
{
|
||||
commits_ahead = "0";
|
||||
}
|
||||
|
||||
var out_contents =
|
||||
"#define SCM_REV_STR \"" + revision + "\"\n" +
|
||||
"#define SCM_DESC_STR \"" + describe + "\"\n" +
|
||||
|
Reference in New Issue
Block a user