Better restriction to prevent Windows git install on XP or older.

This is in preparation for once again making 1.8.5.2 the default Windows git.

Also remove the CHROME_HEADLESS condition, which confuses bot setup because the
same bot will sometimes run without that set (e.g. at slave startup) and with
it set (e.g. during a build), leading to the wrong, or even no, git installed.

R=maruel@chromium.org

Review URL: https://codereview.chromium.org/160033002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@250486 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/bootstrap/win/win_tools.bat b/bootstrap/win/win_tools.bat
index ee19b58..2e74896 100644
--- a/bootstrap/win/win_tools.bat
+++ b/bootstrap/win/win_tools.bat
@@ -35,12 +35,24 @@
 

 :GIT_1852_CHECK

 set GIT_VERSION=1.8.5.2.chromium.1

+:: This git uses APIs that target WINVER 0x0502, so refuse to install it on

+:: anything older.

+for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSTR=%%i

+for /f "tokens=2,3 delims=. " %%i in ("%VERSTR%") do (set VERMAJOR=%%i & set VERMINOR=%%j)

+if %VERMAJOR% lss 5 goto :GIT_VER_UNSUPPORTED

+if %VERMAJOR% equ 5 if %VERMINOR% lss 2 goto :GIT_VER_UNSUPPORTED

 set GIT_BIN_DIR=git-%GIT_VERSION%_bin

 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip

 set GIT_ZIP_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_FILE%

 goto :GIT_COMMON

 

 

+:GIT_VER_UNSUPPORTED

+echo Git %GIT_VERSION% cannot be installed on:

+ver

+goto :GIT_180_CHECK

+

+

 :GIT_180_FORCE

 :: If the new git was installed, remove all installed git packages to trigger

 :: reinstallation of the old version.

@@ -64,7 +76,6 @@
 :GIT_COMMON

 :: If the batch file exists, skip the git check.

 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_PATH_CHECK

-if "%CHROME_HEADLESS%" == "1" goto :SVN_CHECK

 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL

 call git --version 2>nul 1>nul

 if errorlevel 1 goto :GIT_INSTALL