News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Extended client reports Standard revision number

Started by Matthew, December 13, 2020, 08:49:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Matthew

Steps to reproduce

1. 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.

(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

prissi

In the git commit you linked first, just the line with REV = needs to be set again to the original state, since it gather the state from standard ...

jamespetts

Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.