Steps to reproduce1. Start the Simutrans-Extended client using a build from 2020-12-13 or later using Windows 10 and with logging turned on
2. Observe that the title bar displays a Standard revision number (currently #9499)
3. Open simu.log and observe that the first line records the same Standard revision number
Expected outcome: Extended reports the Git commit hash of the current build.
This change was probably made by
this commit.
By the way, I started to prepare a report concerning a different possible bug in the commit hash code earlier this year. I eventually realized that the error I was investigating was caused by a configuration error that I made. But if you are trying to fix the bug above and see a "Git output not valid!" error message, then the following notes may help. if you don't see that message, you can ignore everything below this line.
-------------------------------------------------------------
1>git : Not a git repository warning GitNR0: Git output not valid! Check if the folder is actually versioned. Revision number will be set to zero. You won't be able to play online with this build.
This error message is
not the similar one generated by Git itself, but is produced by Sim-Ex's revision.jse file. Neither VS nor VSCode recognized the language of this file. It appears to be an ActiveX control run by cscript (the command-line version of the Windows Scripting Host), but the same function names are used by many Microsoft languages, so I'm not certain.
If I understand revision.jse correctly (which is a dubious assumption), this particular error message is triggered by this snippet of code:
// Try to get revision number
try {
var gitRevNum = shell.Exec("git rev-parse --short=7 HEAD");
rev = gitRevNum.StdOut.ReadAll();
// Check if Git output is valid
if (rev.length !== 9) {
WSH.Echo("git : Not a git repository warning GitNR" + errorcode + ":Git output not valid! Check if the folder is actually versioned." + errormsg);
rev = 0;
}
}
I ran the
git rev-parse --short=7 HEAD command in cmd.exe and it produces a revision number truncated to 7 characters (as instructed by
short=7) from the latest Git commit hash (which is 9 characters). So it seems that this test is guaranteed to fail. The truncation was introduced by AndrewCarlotti in
this commit.