mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-11-04 11:22:13 +08:00 
			
		
		
		
	Merge pull request #2357 from FloSchwalm/fix-git-version-comparison
Fix git version comparison
This commit is contained in:
		
							
								
								
									
										5
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							@@ -235,7 +235,9 @@ goto :CONFIGURE_GIT
 | 
			
		||||
:CONFIGURE_GIT
 | 
			
		||||
%lib_console% debug_output "Using Git from '%GIT_INSTALL_ROOT%..."
 | 
			
		||||
:: 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 (
 | 
			
		||||
    %lib_console% verbose_output "Preferring Windows commands"
 | 
			
		||||
    set "path_position=append"
 | 
			
		||||
@@ -244,7 +246,6 @@ if %nix_tools% equ 1 (
 | 
			
		||||
    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 exist "%GIT_INSTALL_ROOT%\mingw32" (
 | 
			
		||||
        %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position%
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/lib/lib_git.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/lib/lib_git.cmd
									
									
									
									
										vendored
									
									
								
							@@ -231,26 +231,28 @@ exit /b
 | 
			
		||||
:::-------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
:compare_git_versions
 | 
			
		||||
    if %errorlevel% geq 0 (
 | 
			
		||||
    if ERRORLEVEL 0 (
 | 
			
		||||
        :: compare the user git version against the vendored version
 | 
			
		||||
        %lib_git% compare_versions USER VENDORED
 | 
			
		||||
 | 
			
		||||
        :: 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 test_dir=
 | 
			
		||||
        ) else if %errorlevel% geq 0 (
 | 
			
		||||
            ) else (
 | 
			
		||||
                set "GIT_INSTALL_ROOT=%test_dir%"
 | 
			
		||||
                set test_dir=
 | 
			
		||||
            )
 | 
			
		||||
        ) 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=
 | 
			
		||||
        )
 | 
			
		||||
    ) else (
 | 
			
		||||
        :: compare the user git version against the vendored version
 | 
			
		||||
        :: if the user provided git executable is not found
 | 
			
		||||
        if %errorlevel% equ -255 (
 | 
			
		||||
            call :verbose_output No git at "%git_executable%" found.
 | 
			
		||||
        IF ERRORLEVEL -255 IF NOT ERRORLEVEL -254 (
 | 
			
		||||
            %lib_console% verbose_output "No git at "%git_executable%" found."
 | 
			
		||||
            set test_dir=
 | 
			
		||||
        )
 | 
			
		||||
    )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user