mirror of
https://github.com/cmderdev/cmder.git
synced 2025-01-11 00:39:08 +08:00
Use ERRORLEVEL instead of %errorlevel% to compare git versions
%errorlevel% was always 0, even if the vendored git version was more current than the installed one Usually exiting a batch script with "exit /b exitCode" as used in :compare_versions sets %errorlevel% to the specified exit code However, this may not work if %errorlevel% was set before with "Set errorlevel=" I didn't find the location where this might have happened, but I saw the consequence of %errorlevel% always being 0 Thus I decided to use ERRORLEVEL instead as this will always work regardless of environment variable For more information check https://ss64.com/nt/errorlevel.html
This commit is contained in:
parent
0c41d5f5d4
commit
cd50db3a7f
8
vendor/lib/lib_git.cmd
vendored
8
vendor/lib/lib_git.cmd
vendored
@ -231,15 +231,15 @@ 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 if exist "%test_dir:~0,-4%\cmd\git.exe" (
|
||||||
set "GIT_INSTALL_ROOT=%test_dir:~0,-4%"
|
set "GIT_INSTALL_ROOT=%test_dir:~0,-4%"
|
||||||
set test_dir=
|
set test_dir=
|
||||||
) else if %errorlevel% geq 0 (
|
) else if ERRORLEVEL 0 (
|
||||||
set "GIT_INSTALL_ROOT=%test_dir%"
|
set "GIT_INSTALL_ROOT=%test_dir%"
|
||||||
set test_dir=
|
set test_dir=
|
||||||
) else (
|
) else (
|
||||||
@ -249,7 +249,7 @@ exit /b
|
|||||||
) 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.
|
call :verbose_output No git at "%git_executable%" found.
|
||||||
set test_dir=
|
set test_dir=
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user