Merge pull request #2357 from FloSchwalm/fix-git-version-comparison

Fix git version comparison
This commit is contained in:
Dax T Games 2020-07-29 20:27:23 -04:00 committed by GitHub
commit 80f76ad956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 12 deletions

5
vendor/init.bat vendored
View File

@ -235,7 +235,9 @@ goto :CONFIGURE_GIT
:CONFIGURE_GIT :CONFIGURE_GIT
%lib_console% debug_output "Using Git from '%GIT_INSTALL_ROOT%..." %lib_console% debug_output "Using Git from '%GIT_INSTALL_ROOT%..."
:: Add git to the path :: Add git to the path
rem add the unix commands at the end to not shadow windows commands like more if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" ""
:: Add the unix commands at the end to not shadow windows commands like more
if %nix_tools% equ 1 ( if %nix_tools% equ 1 (
%lib_console% verbose_output "Preferring Windows commands" %lib_console% verbose_output "Preferring Windows commands"
set "path_position=append" set "path_position=append"
@ -244,7 +246,6 @@ if %nix_tools% equ 1 (
set "path_position=" set "path_position="
) )
if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" %path_position%
if %nix_tools% geq 1 ( if %nix_tools% geq 1 (
if exist "%GIT_INSTALL_ROOT%\mingw32" ( if exist "%GIT_INSTALL_ROOT%\mingw32" (
%lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position% %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position%

View File

@ -231,26 +231,28 @@ exit /b
:::------------------------------------------------------------------------------- :::-------------------------------------------------------------------------------
:compare_git_versions :compare_git_versions
if %errorlevel% geq 0 ( if ERRORLEVEL 0 (
:: compare the user git version against the vendored version :: compare the user git version against the vendored version
%lib_git% compare_versions USER VENDORED %lib_git% compare_versions USER VENDORED
:: use the user provided git if its version is greater than, or equal to the vendored git :: use the user provided git if its version is greater than, or equal to the vendored git
if %errorlevel% geq 0 if exist "%test_dir:~0,-4%\cmd\git.exe" ( if ERRORLEVEL 0 (
set "GIT_INSTALL_ROOT=%test_dir:~0,-4%" if exist "%test_dir:~0,-4%\cmd\git.exe" (
set test_dir= set "GIT_INSTALL_ROOT=%test_dir:~0,-4%"
) else if %errorlevel% geq 0 ( set test_dir=
set "GIT_INSTALL_ROOT=%test_dir%" ) else (
set test_dir= set "GIT_INSTALL_ROOT=%test_dir%"
set test_dir=
)
) else ( ) else (
call :verbose_output Found old %GIT_VERSION_USER% in "%test_dir%", but not using... %lib_console% verbose_output "Found old %GIT_VERSION_USER% in %test_dir%, but not using..."
set test_dir= set test_dir=
) )
) else ( ) else (
:: compare the user git version against the vendored version :: compare the user git version against the vendored version
:: if the user provided git executable is not found :: if the user provided git executable is not found
if %errorlevel% equ -255 ( IF ERRORLEVEL -255 IF NOT ERRORLEVEL -254 (
call :verbose_output No git at "%git_executable%" found. %lib_console% verbose_output "No git at "%git_executable%" found."
set test_dir= set test_dir=
) )
) )