From 49072d6e02e508dc7d301331494fbcc0b9a85f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20A=2E=20Col=C3=B3n=20V=C3=A9lez?= Date: Fri, 11 Sep 2015 19:20:23 -0400 Subject: [PATCH] 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. --- common/vsprops/preBuild.cmd | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/common/vsprops/preBuild.cmd b/common/vsprops/preBuild.cmd index 2d7d61fcc5..9f5c6979e2 100644 --- a/common/vsprops/preBuild.cmd +++ b/common/vsprops/preBuild.cmd @@ -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,