Changeset - r19871:c3ebfcae0fbd
[Not reviewed]
master
0 1 0
glx - 12 years ago 2012-12-19 02:42:25
glx@openttd.org
(svn r24826) -Fix: determineversion.vbs could hang in a git checkout
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
projects/determineversion.vbs
Show inline comments
 
@@ -156,48 +156,51 @@ Function DetermineSVNVersion()
 
	End If ' InStr(version, "$")
 

	
 
	If version <> "norev000" Then
 
		If InStr(url, "branches") Then
 
			branch = Mid(url, InStr(url, "branches/") + 9)
 
		End If
 
		If InStr(url, "tags") Then
 
			version = Mid(url, InStr(url, "tags/") + 5)
 
		End If
 
	Else ' version <> "norev000"
 
		' svn detection failed, reset error and try git
 
		Err.Clear
 
		Set oExec = WshShell.Exec("git rev-parse --verify HEAD")
 
		If Err.Number = 0 Then
 
			' Wait till the application is finished ...
 
			Do While oExec.Status = 0
 
			Loop
 

	
 
			If oExec.ExitCode = 0 Then
 
				hash = oExec.StdOut.ReadLine()
 
				version = "g" & Mid(hash, 1, 8)
 
				' Make sure index is in sync with disk
 
				Set oExec = WshShell.Exec("git update-index --refresh")
 
				If Err.Number = 0 Then
 
					' StdOut and StdErr share a 4kB buffer so prevent it from filling up as we don't care about the output
 
					oExec.StdOut.Close
 
					oExec.StdErr.Close
 
					' Wait till the application is finished ...
 
					Do While oExec.Status = 0
 
						WScript.Sleep 10
 
					Loop
 
				End If
 
				Set oExec = WshShell.Exec("git diff-index --exit-code --quiet HEAD ../")
 
				If Err.Number = 0 Then
 
					' Wait till the application is finished ...
 
					Do While oExec.Status = 0
 
					Loop
 

	
 
					If oExec.ExitCode = 1 Then
 
						modified = 2
 
					End If ' oExec.ExitCode = 1
 

	
 
					Set oExec = WshShell.Exec("git symbolic-ref HEAD")
 
					If Err.Number = 0 Then
 
						line = oExec.StdOut.ReadLine()
 
						line = Mid(line, InStrRev(line, "/") + 1)
 
						If line <> "master" Then
 
							branch = line
 
						End If ' line <> "master"
 
					End If ' Err.Number = 0
 

	
0 comments (0 inline, 0 general)