The International Simutrans Forum

 

Author Topic: Extended client reports Standard revision number  (Read 390 times)

0 Members and 1 Guest are viewing this topic.

Offline Matthew

  • Devotee
  • *
  • Posts: 560
    • Japan Railway Journal
  • Languages: EN, some ZH, DE & SQ
Extended client reports Standard revision number
« on: December 13, 2020, 08:49:04 PM »
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.

-------------------------------------------------------------

Code: [Select]
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:
Code: [Select]
// 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.


Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10638
  • Languages: De,EN,JP
Re: Extended client reports Standard revision number
« Reply #1 on: December 14, 2020, 02:27:43 AM »
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 ...

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20774
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Extended client reports Standard revision number
« Reply #2 on: December 14, 2020, 10:26:56 PM »
Thank you both - I have now reverted this.