mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-11-04 19:32:13 +08:00 
			
		
		
		
	add setlocal
This commit is contained in:
		
							
								
								
									
										15
									
								
								vendor/lib/lib_git.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								vendor/lib/lib_git.cmd
									
									
									
									
										vendored
									
									
								
							@@ -232,30 +232,33 @@ exit /b
 | 
			
		||||
 | 
			
		||||
:compare_git_versions
 | 
			
		||||
    if ERRORLEVEL 0 (
 | 
			
		||||
        setlocal enabledelayedexpansion
 | 
			
		||||
        :: 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
 | 
			
		||||
        if ERRORLEVEL 0 (
 | 
			
		||||
            if exist "%test_dir:~0,-4%\cmd\git.exe" (
 | 
			
		||||
                set "GIT_INSTALL_ROOT=%test_dir:~0,-4%"
 | 
			
		||||
            if exist "!test_dir:~0,-4!\cmd\git.exe" (
 | 
			
		||||
                set "GIT_INSTALL_ROOT=!test_dir:~0,-4!"
 | 
			
		||||
                set test_dir=
 | 
			
		||||
            ) else (
 | 
			
		||||
                set "GIT_INSTALL_ROOT=%test_dir%"
 | 
			
		||||
                set "GIT_INSTALL_ROOT=!test_dir!"
 | 
			
		||||
                set test_dir=
 | 
			
		||||
            )
 | 
			
		||||
        ) else (
 | 
			
		||||
            %lib_console% 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=
 | 
			
		||||
        )
 | 
			
		||||
        endlocal && set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%
 | 
			
		||||
    ) 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 (
 | 
			
		||||
            %lib_console% verbose_output "No git at "%git_executable%" found."
 | 
			
		||||
            !lib_console! verbose_output "No git at "!git_executable!" found."
 | 
			
		||||
            set test_dir=
 | 
			
		||||
        )
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    exit /b
 | 
			
		||||
 | 
			
		||||
:::===============================================================================
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								vendor/lib/lib_path.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								vendor/lib/lib_path.cmd
									
									
									
									
										vendored
									
									
								
							@@ -77,24 +77,24 @@ exit /b
 | 
			
		||||
    set OLD_PATH=%PATH%
 | 
			
		||||
 | 
			
		||||
    setlocal enabledelayedexpansion
 | 
			
		||||
    if "%found%" == "0" (
 | 
			
		||||
      echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%;"
 | 
			
		||||
    if "!found!" == "0" (
 | 
			
		||||
      echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!;"
 | 
			
		||||
      call :set_found
 | 
			
		||||
    )
 | 
			
		||||
    %lib_console% debug_output  :enhance_path "Env Var INSIDE PATH %find_query% - found=%found%"
 | 
			
		||||
    !lib_console! debug_output  :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!"
 | 
			
		||||
 | 
			
		||||
    if /i "%position%" == "append" (
 | 
			
		||||
    if /i "!position!" == "append" (
 | 
			
		||||
      if "!found!" == "0" (
 | 
			
		||||
        echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%\"$"
 | 
			
		||||
        echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!\"$"
 | 
			
		||||
        call :set_found
 | 
			
		||||
      )
 | 
			
		||||
      %lib_console% debug_output  :enhance_path "Env Var END PATH %find_query% - found=!found!"
 | 
			
		||||
      !lib_console! debug_output  :enhance_path "Env Var END PATH !find_query! - found=!found!"
 | 
			
		||||
    ) else (
 | 
			
		||||
      if "!found!" == "0" (
 | 
			
		||||
        echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:"^\"%find_query%;"
 | 
			
		||||
        echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:"^\"!find_query!;"
 | 
			
		||||
        call :set_found
 | 
			
		||||
      )
 | 
			
		||||
      %lib_console% debug_output  :enhance_path "Env Var BEGIN PATH %find_query% - found=!found!"
 | 
			
		||||
      !lib_console! debug_output  :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!"
 | 
			
		||||
    )
 | 
			
		||||
    endlocal & set found=%found%
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user