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
 | 
					: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%
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										22
									
								
								vendor/lib/lib_git.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								vendor/lib/lib_git.cmd
									
									
									
									
										vendored
									
									
								
							@@ -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=
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user