mirror of
https://github.com/cmderdev/cmder.git
synced 2025-06-15 22:27:51 +08:00
fix find latest git
This commit is contained in:
18
vendor/lib/lib_git.cmd
vendored
18
vendor/lib/lib_git.cmd
vendored
@ -163,9 +163,9 @@ exit /b
|
||||
:: checks all major, minor, patch and build variables for the given arguments.
|
||||
:: whichever binary that has the most recent version will be used based on the return code.
|
||||
|
||||
%print_debug% Comparing:
|
||||
%print_debug% %~1: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD%
|
||||
%print_debug% %~2: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD%
|
||||
%print_debug% ":compare_versions" "Comparing:"
|
||||
%print_debug% ":compare_versions" "%~1: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD%"
|
||||
%print_debug% ":compare_versions" "%~2: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD%"
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
if !%~1_MAJOR! GTR !%~2_MAJOR! (endlocal & exit /b 1)
|
||||
@ -233,23 +233,26 @@ exit /b
|
||||
setlocal enabledelayedexpansion
|
||||
if ERRORLEVEL 0 (
|
||||
:: compare the user git version against the vendored version
|
||||
!lib_git! compare_versions USER VENDORED
|
||||
%lib_git% compare_versions USER VENDORED
|
||||
set result=!ERRORLEVEL!
|
||||
%print_debug% ":compare_git_versions" "campare versions_result: !result!"
|
||||
|
||||
:: use the user provided git if its version is greater than, or equal to the vendored git
|
||||
if ERRORLEVEL 0 (
|
||||
if !result! geq 0 (
|
||||
if exist "!test_dir:~0,-4!\cmd\git.exe" (
|
||||
set "GIT_INSTALL_ROOT=!test_dir:~0,-4!"
|
||||
) else (
|
||||
set "GIT_INSTALL_ROOT=!test_dir!"
|
||||
)
|
||||
) else (
|
||||
%print_verbose% "Found old !GIT_VERSION_USER! in !test_dir!, but not using..."
|
||||
%print_debug% ":compare_git_versions" "Found old !GIT_VERSION_USER! in !test_dir!, but not using..."
|
||||
)
|
||||
) else (
|
||||
:: compare the user git version against the vendored version
|
||||
:: if the user provided git executable is not found
|
||||
IF ERRORLEVEL -255 IF NOT ERRORLEVEL -254 (
|
||||
%print_verbose% "No git at "!git_executable!" found."
|
||||
:: if not exist "%git_executable%" (
|
||||
%print_debug% ":compare_git_versions" "No git at "%git_executable%" found."
|
||||
set test_dir=
|
||||
)
|
||||
)
|
||||
@ -272,6 +275,7 @@ exit /b
|
||||
:get_user_git_version
|
||||
:: get the version information for the user provided git binary
|
||||
%lib_git% read_version USER "%test_dir%" 2>nul
|
||||
%print_debug% ":get_user_git_version" "get_user_git_version GIT_VERSION_USER: %GIT_VERSION_USER%"
|
||||
%lib_git% validate_version USER %GIT_VERSION_USER%
|
||||
exit /b
|
||||
|
||||
|
Reference in New Issue
Block a user