Fix git version detection

- It currently fails to detect a 64bit git.
- It currently breaks with a TZ left of the Greenwich meridian.
- The output of git show -s can cause compilation errors pipe to NUL.
- Pipe the two can't find the git command error messages to NUL too.
This commit is contained in:
Miguel A. Colón Vélez 2015-09-11 19:20:23 -04:00
parent 0a7eed686c
commit 49072d6e02
1 changed files with 7 additions and 10 deletions

View File

@ -13,23 +13,20 @@
SETLOCAL ENABLEEXTENSIONS
set mydir=%~dp0
IF EXIST "%ProgramFiles(x86)%\Git\bin\git.exe" SET "GITPATH=%ProgramFiles(x86)%\Git\bin"
IF EXIST "%ProgramFiles%\Git\bin\git.exe" SET "GITPATH=%ProgramFiles%\Git\bin"
IF EXIST "%ProgramW6432%\Git\bin\git.exe" SET "GITPATH=%ProgramW6432%\Git\bin"
IF DEFINED GITPATH SET "PATH=%PATH%;%GITPATH%"
IF "%PROGRAMFILES(x86)%" == "" do (
set PROGRAMFILES(x86)=%PROGRAMFILES%
)
set PATH=%PATH%;"%PROGRAMFILES(x86)%\Git\bin"
FOR /F "delims=+" %%i IN ('"git show -s --format=%%%ci HEAD"') do (
set REV3=%%i
FOR /F "tokens=1-2" %%i IN ('"git show -s --format=%%%ci HEAD 2> NUL"') do (
set REV3=%%i%%j
)
set REV2=%REV3: =%
set REV1=%REV2:-=%
set REV=%REV1::=%
git show -s
git show -s > NUL 2>&1
if %ERRORLEVEL% NEQ 0 (
echo Automatic version detection unavailable.
echo If you want to have the version string print correctly,