mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-10-31 09:22:15 +08:00 
			
		
		
		
	Merge pull request #2380 from daxgames/fix_git_not_expected
Fix `\Git\cmd\git.exe" found." was unexpected at this time.`
This commit is contained in:
		
							
								
								
									
										8
									
								
								vendor/bin/cexec.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/bin/cexec.cmd
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,4 @@ | |||||||
| @echo off | @echo off | ||||||
| setlocal |  | ||||||
|  |  | ||||||
| if "%~1" equ "" goto :wrongSyntax | if "%~1" equ "" goto :wrongSyntax | ||||||
|  |  | ||||||
| @@ -8,6 +7,7 @@ if not defined CMDER_USER_FLAGS ( | |||||||
|   set "CMDER_USER_FLAGS= " |   set "CMDER_USER_FLAGS= " | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  |  | ||||||
| set "feNot=false" | set "feNot=false" | ||||||
| goto :parseArgument | goto :parseArgument | ||||||
|  |  | ||||||
| @@ -17,10 +17,8 @@ goto :parseArgument | |||||||
| :parseArgument | :parseArgument | ||||||
| set "currenArgu=%~1" | set "currenArgu=%~1" | ||||||
| if /i "%currenArgu%" equ "/setPath" ( | if /i "%currenArgu%" equ "/setPath" ( | ||||||
|   :: set %flag_exists% shortcut |   set ccall=call "%~dp0cexec.cmd" | ||||||
|   endlocal |   set cexec="%~dp0cexec.cmd" | ||||||
|   set "ccall=call ^"%~dp0cexec.cmd^"" |  | ||||||
|   set "cexec=^"%~dp0cexec.cmd^"" |  | ||||||
| ) else if /i "%currenArgu%" == "/?" ( | ) else if /i "%currenArgu%" == "/?" ( | ||||||
|   goto :help |   goto :help | ||||||
| ) else if /i "%currenArgu%" equ "/help" ( | ) else if /i "%currenArgu%" equ "/help" ( | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							| @@ -265,14 +265,17 @@ if not defined git_locale for /F "tokens=* delims=" %%F in ('where locale.exe 2^ | |||||||
| if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\env.exe" /usr/bin/locale | if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\env.exe" /usr/bin/locale | ||||||
| if not defined git_locale for /F "tokens=* delims=" %%F in ('where env.exe 2^>nul') do ( if not defined git_locale  set git_locale="%%F" /usr/bin/locale ) | if not defined git_locale for /F "tokens=* delims=" %%F in ('where env.exe 2^>nul') do ( if not defined git_locale  set git_locale="%%F" /usr/bin/locale ) | ||||||
|  |  | ||||||
|  | setlocal enabledelayedexpansion | ||||||
| if defined git_locale ( | if defined git_locale ( | ||||||
|   %lib_console% debug_output init.bat "Env Var - git_locale=%git_locale%" |  | ||||||
|  |   REM !lib_console! debug_output init.bat "Env Var - git_locale=!git_locale!" | ||||||
|   if not defined LANG ( |   if not defined LANG ( | ||||||
|       for /F "delims=" %%F in ('%git_locale% -uU 2') do ( |       for /F "delims=" %%F in ('!git_locale! -uU 2') do ( | ||||||
|           set "LANG=%%F" |           set "LANG=%%F" | ||||||
|       ) |       ) | ||||||
|   ) |   ) | ||||||
| ) | ) | ||||||
|  | endlocal && set LANG=%LANG% | ||||||
|  |  | ||||||
| %lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" | %lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" | ||||||
| %lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" | %lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" | ||||||
|   | |||||||
							
								
								
									
										18
									
								
								vendor/lib/lib_git.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								vendor/lib/lib_git.cmd
									
									
									
									
										vendored
									
									
								
							| @@ -231,31 +231,31 @@ exit /b | |||||||
| :::------------------------------------------------------------------------------- | :::------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| :compare_git_versions | :compare_git_versions | ||||||
|  |     setlocal enabledelayedexpansion | ||||||
|     if ERRORLEVEL 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 0 ( |         if ERRORLEVEL 0 ( | ||||||
|             if exist "%test_dir:~0,-4%\cmd\git.exe" ( |             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= |  | ||||||
|             ) else ( |             ) else ( | ||||||
|                 set "GIT_INSTALL_ROOT=%test_dir%" |                 set "GIT_INSTALL_ROOT=!test_dir!" | ||||||
|                 set test_dir= |  | ||||||
|             ) |             ) | ||||||
|         ) else ( |         ) 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= |  | ||||||
|         ) |         ) | ||||||
|     ) 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 -255 IF NOT ERRORLEVEL -254 ( |         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= |             set test_dir= | ||||||
|         ) |         ) | ||||||
|     ) |     ) | ||||||
|  |     endlocal && set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" && set test_dir= | ||||||
|  |  | ||||||
|     exit /b |     exit /b | ||||||
|  |  | ||||||
| :::=============================================================================== | :::=============================================================================== | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								vendor/lib/lib_path.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								vendor/lib/lib_path.cmd
									
									
									
									
										vendored
									
									
								
							| @@ -77,24 +77,24 @@ exit /b | |||||||
|     set OLD_PATH=%PATH% |     set OLD_PATH=%PATH% | ||||||
|  |  | ||||||
|     setlocal enabledelayedexpansion |     setlocal enabledelayedexpansion | ||||||
|     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%" |  | ||||||
|  |  | ||||||
|     if /i "%position%" == "append" ( |  | ||||||
|     if "!found!" == "0" ( |     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 |       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 INSIDE PATH !find_query! - found=!found!" | ||||||
|  |  | ||||||
|  |     if /i "!position!" == "append" ( | ||||||
|  |       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 END PATH !find_query! - found=!found!" | ||||||
|     ) else ( |     ) else ( | ||||||
|       if "!found!" == "0" ( |       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 |         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% |     endlocal & set found=%found% | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user