From c1c5fd8a38a9fdd3dfa6f8fc43f35cea15ee21e3 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 27 Sep 2020 20:16:42 -0400 Subject: [PATCH 1/6] make cmd::cmder use user installed git path if vendored is newer --- vendor/bin/cmder_sub_git_for_windows_path.cmd | 15 ++ vendor/init.bat | 78 +++++++---- vendor/lib/lib_git.cmd | 50 ++++--- vendor/profile.ps1 | 5 +- vendor/psmodules/Cmder.ps1 | 130 +++++------------- 5 files changed, 137 insertions(+), 141 deletions(-) create mode 100644 vendor/bin/cmder_sub_git_for_windows_path.cmd diff --git a/vendor/bin/cmder_sub_git_for_windows_path.cmd b/vendor/bin/cmder_sub_git_for_windows_path.cmd new file mode 100644 index 000000000..3da65db33 --- /dev/null +++ b/vendor/bin/cmder_sub_git_for_windows_path.cmd @@ -0,0 +1,15 @@ +@echo off + +setlocal enabledelayedexpansion +set search=%~1 +set replace=%~2 + + +echo %search% | findstr -i "git" >nul +if "%errorlevel%" == "1" exit /b + +set path=!path:%search%=%replace%! +(endlocal + set "path=%path%") + +exit /b diff --git a/vendor/init.bat b/vendor/init.bat index 96ad7513f..13b50ea9b 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -23,7 +23,10 @@ if not defined fast_init set fast_init=0 :: Use /max_depth 1-5 to set max recurse depth for calls to `enhance_path_recursive` if not defined max_depth set max_depth=1 -:: Add *nix tools to end of path. 0 turns off *nix tools, 2 adds *nix tools to the front of thr path. +:: Control *nix tools path. +:: 0 turns off *nix tools. +:: 1 Add *nix tools tho end of path. +:: 2 Adds *nix tools to the front of the path. if not defined nix_tools set nix_tools=1 set "CMDER_USER_FLAGS= " @@ -205,20 +208,36 @@ if defined GIT_INSTALL_ROOT ( :: check if git is in path... for /F "delims=" %%F in ('where git.exe 2^>nul') do ( :: get the absolute path to the user provided git binary + %lib_git% set_user_git_path "%%~dpF" %lib_git% is_git_shim "%%~dpF" %lib_git% get_user_git_version - %lib_git% compare_git_versions + if ERRORLEVEL 0 ( + %lib_git% compare_git_versions + ) 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." + set test_dir= + ) + ) if defined GIT_INSTALL_ROOT ( + set GIT_INSTALL_TYPE=USER goto :FOUND_GIT ) ) +set git_executable= + +REM echo Git User Path XXX: %CMDER_USER_GIT_PATH% :: our last hope: our own git... :VENDORED_GIT -if exist "%CMDER_ROOT%\vendor\git-for-windows" ( +REM if exist "%CMDER_ROOT%\vendor\git-for-windows" ( +if not defined GIT_INSTALL_ROOT if defined GIT_VERSION_VENDORED ( set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows" - %lib_console% debug_output "Using vendored Git '%GIT_VERSION_VENDORED%'..." + set GIT_INSTALL_TYPE=VENDOR + %lib_console% debug_output "Newer user Git NOT found using vendored Git '%GIT_VERSION_VENDORED%'..." goto :CONFIGURE_GIT ) else ( goto :NO_GIT @@ -233,28 +252,39 @@ goto :CONFIGURE_GIT goto :CONFIGURE_GIT :CONFIGURE_GIT -%lib_console% debug_output "Using Git from '%GIT_INSTALL_ROOT%..." -:: Add git to the path -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" -) else ( - %lib_console% verbose_output "Preferring *nix commands" - set "path_position=" -) +setlocal enabledelayedexpansion +if "%GIT_INSTALL_TYPE%" equ "VENDOR" ( + set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows" + if defined GIT_VERSION_USER ( + %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." -if %nix_tools% geq 1 ( - if exist "%GIT_INSTALL_ROOT%\mingw32" ( - %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position% - ) else if exist "%GIT_INSTALL_ROOT%\mingw64" ( - %lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw64\bin" %path_position% - ) + call "%cmder_root%\vendor\bin\cmder_sub_git_for_windows_path.cmd" "%CMDER_USER_GIT_PATH%" "%GIT_INSTALL_ROOT%\" + ) else ( + %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." + + :: Add git to the path + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" "" - %lib_path% enhance_path "%GIT_INSTALL_ROOT%\usr\bin" %path_position% + :: 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" + ) else ( + %lib_console% verbose_output "Preferring *nix commands" + set "path_position=" + ) + + if %nix_tools% geq 1 ( + if exist "!GIT_INSTALL_ROOT!\mingw32" ( + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! + ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position! + ) + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" !path_position! + ) + ) ) +endlocal & set GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT% & set path=%path% :: define SVN_SSH so we can use git svn with ssh svn repositories if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe" @@ -266,7 +296,7 @@ if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_ 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 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 ( for /F "delims=" %%F in ('%git_locale% -uU 2') do ( set "LANG=%%F" diff --git a/vendor/lib/lib_git.cmd b/vendor/lib/lib_git.cmd index b55ff6a0b..cbcf6962d 100644 --- a/vendor/lib/lib_git.cmd +++ b/vendor/lib/lib_git.cmd @@ -231,31 +231,23 @@ exit /b :::------------------------------------------------------------------------------- :compare_git_versions + :: compare the user git version against the vendored version + %lib_git% compare_versions USER VENDORED + + if exist "%test_dir:~0,-4%\cmd\git.exe" ( + set "gitFolder=%test_dir:~0,-4%" + ) else ( + set "gitFolder=%test_dir%" + ) + + :: use the user provided git if its version is greater than, or equal to the vendored git 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 0 ( - 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 test_dir= - ) - ) else ( - %lib_console% verbose_output "Found old %GIT_VERSION_USER% in %test_dir%, but not using..." - set test_dir= - ) + set "GIT_INSTALL_ROOT=%gitFolder%" ) 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." - set test_dir= - ) + %lib_console% verbose_output "Found old %GIT_VERSION_USER% in %test_dir%, but not using..." ) + set gitFolder= + set test_dir= exit /b :::=============================================================================== @@ -276,3 +268,17 @@ exit /b %lib_git% validate_version USER %GIT_VERSION_USER% exit /b +:set_user_git_path + setlocal enabledelayedexpansion + set x=%~1 + if not defined CMDER_USER_GIT_PATH set "CMDER_USER_GIT_PATH=%x:~0,-4%" && goto set_user_path_end + if defined CMDER_USER_GIT_PATH echo %x% | findstr "!CMDER_USER_GIT_PATH!" >nul + if defined CMDER_USER_GIT_PATH if ERRORLEVEL 1 ( + set "CMDER_USER_GIT_PATH=%x:~0,-4%" + ) + + :set_user_path_end + (endlocal + set "CMDER_USER_GIT_PATH=%CMDER_USER_GIT_PATH%") + + exit /b diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index ef1bfa015..afbf35ade 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -53,8 +53,9 @@ foreach ($git in (get-command -ErrorAction SilentlyContinue 'git')) { # write-host "Using GIT Version: ${useGitVersion}" # Use user installed Git + $gitPathUser = ($gitDir.subString(0,$gitDir.Length - 4)) if ($useGitVersion -eq $gitVersionUser) { - $ENV:GIT_INSTALL_ROOT = ($gitDir.subString(0,$gitDir.Length - 4)) + $ENV:GIT_INSTALL_ROOT = $gitPathUser $ENV:GIT_INSTALL_TYPE = 'USER' break } @@ -70,7 +71,7 @@ if ($ENV:GIT_INSTALL_ROOT -eq $null -and $gitVersionVendor -ne $null) { # write-host "GIT_INSTALL_TYPE: ${ENV:GIT_INSTALL_TYPE}" if (-not($ENV:GIT_INSTALL_ROOT -eq $null)) { - Configure-Git -gitRoot "$ENV:GIT_INSTALL_ROOT" -gitType $ENV:GIT_INSTALL_TYPE + $env:Path = Configure-Git -gitRoot "$ENV:GIT_INSTALL_ROOT" -gitType $ENV:GIT_INSTALL_TYPE -gitPathUser $gitPathUser } if ( Get-command -Name "vim" -ErrorAction silentlycontinue) { diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index 37c8090a8..a2dec68df 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -19,14 +19,14 @@ function readVersion($gitPath) { function isGitShim($gitPath) { # check if there's shim - and if yes follow the path - + if (test-path "${gitPath}\git.shim") { $shim = (get-content "${gitPath}\git.shim") ($trash, $gitPath) = $shim.replace(' ','').split('=') - $gitPath=$gitPath.replace('\git.exe','') - } - + $gitPath=$gitPath.replace('\git.exe','') + } + return $gitPath.toString() } @@ -67,98 +67,42 @@ function compare_git_versions($userVersion, $vendorVersion) { } else { return $vendorVersion } - -} - -function Configure-Git($gitRoot, $gitType){ - # # Current Cmder Behavior - # $GIT_INSTALL_ROOT_ESC=$GIT_INSTALL_ROOT.replace('\','\\') - # if (!($env:Path -match "$GIT_INSTALL_ROOT_ESC\\cmd")) { - # $env:Path = $($GIT_INSTALL_ROOT + "\cmd" + ";" + $env:Path) - # } - # - # # Add "$GIT_INSTALL_ROOT\usr\bin" to the path if exists and not done already - # if ((test-path "$GIT_INSTALL_ROOT\usr\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\usr\\bin")) { - # $env:path = "$env:path;$GIT_INSTALL_ROOT\usr\bin" - # } - - # $env:Path = $($env:Path + ";" $GIT_INSTALL_ROOT + "\cmd") - - # # Add "$GIT_INSTALL_ROOT\mingw[32|64]\bin" to the path if exists and not done already - # if ((test-path "$GIT_INSTALL_ROOT\mingw32\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw32\\bin")) { - # $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw32\bin" - # } elseif ((test-path "$GIT_INSTALL_ROOT\mingw64\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw64\\bin")) { - # $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw64\bin" - # } - - # Proposed Behavior - $gitRootEsc = $gitRoot.replace('\','\\') - if (!($env:Path -match "$gitRootEsc\\cmd")) { - $env:Path = $($gitRoot + "\cmd" + ";" + $env:Path) - } - - # Modify the path if we are using VENDORED Git do nothing if using USER Git. - # If User Git is installed but older match its path config adding paths - # in the same path positions allowing a user to configure Cmder Git path - # using locally installed Git Path Config. - if ($gitType -eq 'VENDOR') { - if (isNixCommand -filename 'curl.exe' -all $true) { - if (isNixCommand -filename 'curl.exe') { - $pathPosition = 'start' - } else { - $pathPosition = 'end' - } - - if ($pathPosition -eq 'end') { - # Add "$gitRoot\mingw[32|64]\bin" to the path if exists and not done already - if ((test-path "$gitRoot\mingw32\bin") -and -not ($env:path -match "$gitRootEsc\\mingw32\\bin")) { - $env:path = "$env:path;$gitRoot\mingw32\bin" - } elseif ((test-path "$gitRoot\mingw64\bin") -and -not ($env:path -match "$gitRootEsc\\mingw64\\bin")) { - $env:path = "$env:path;$gitRoot\mingw64\bin" - } - } elseif ($pathPosition -eq 'start') { - if ((test-path "$gitRoot\mingw32\bin") -and -not ($env:path -match "$gitRootEsc\\mingw32\\bin")) { - $env:path = "$gitRoot\mingw32\bin;$env:path" - } elseif ((test-path "$gitRoot\mingw64\bin") -and -not ($env:path -match "$gitRootEsc\\mingw64\\bin")) { - $env:path = "$gitRoot\mingw64\bin;$env:path" - } - } - } - - if (isNixCommand -filename 'find' -all $true) { - if (isNixCommand -filename 'find') { - $pathPosition = 'start' - } else { - $pathPosition = 'end' - } - - if ($pathPosition -eq 'end') { - $env:path = "$env:path;$gitRoot\usr\bin" - } elseif ($pathPosition -eq 'start') { - $env:path = "$gitRoot\usr\bin;$env:path" - } - } - } -} - -function isWindowsCommand($filename, $all=$false) { - if ($all) { - $commands = (get-command $filename -All).source - } else { - $commands = (get-command $filename).source - } - - return ($commands -match $env:systemroot.replace('\','\\')) } -function isNixCommand($filename, $all=$false) { - if ($all) { - $commands = (get-command $filename -All).source - } else { - $commands = (get-command $filename).source +function Configure-Git($gitRoot, $gitType, $gitPathUser){ + # Proposed Behavior + + # Modify the path if we are using VENDORED Git do nothing if using USER Git. + # If User Git is installed but older match its path config adding paths + # in the same path positions allowing a user to configure Cmder Git path + # using locally installed Git Path Config. + if ($gitType -eq 'VENDOR') { + # If User Git is installed replace its path config with Newer Vendored Git Path + if ($gitPathUser -ne '') { + # write-host "Replacing $gitPathUser with $gitRoot in the path" + $gitPathUserEsc = $gitPathUser.replace('\','\\').replace('(','\(').replace(')','\)') + + $newPath = ($env:path -ireplace $gitPathUserEsc, $gitRoot) + } else { + $gitRootEsc = $gitRoot.replace('\','\\') + if (!($env:Path -match "$gitRootEsc\\cmd")) { + $newPath = $($gitRoot + "\cmd" + ";" + $env:Path) + } + + # Add "$gitRoot\mingw[32|64]\bin" to the path if exists and not done already + if ((test-path "$gitRoot\mingw32\bin") -and -not ($env:path -match "$gitRootEsc\\mingw32\\bin")) { + $newPath = "$newPath;$gitRoot\mingw32\bin" + } elseif ((test-path "$gitRoot\mingw64\bin") -and -not ($env:path -match "$gitRootEsc\\mingw64\\bin")) { + $newPath = "$newPath;$gitRoot\mingw64\bin" + } + + if ((test-path "$gitRoot\usr\bin") -and -not ($env:path -match "$gitRootEsc\\usr\\bin")) { + $newPath = "$newPath;$gitRoot\usr\bin" + } + } } - return ($commands -match '\\git' -and $commands.replace('\','\\') -match '\\bin\\') + return $newPath } function Import-Git(){ @@ -174,7 +118,7 @@ function Import-Git(){ return $true } -function checkGit($Path) { +function checkGit($Path) { if (Test-Path -Path (Join-Path $Path '.git') ) { if($env:gitLoaded -eq 'false') { $env:gitLoaded = Import-Git From 077ea7d9c582c4ef0d34372419fb01ae196eb954 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Fri, 6 Nov 2020 08:44:52 -0500 Subject: [PATCH 2/6] fix --- vendor/psmodules/Cmder.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vendor/psmodules/Cmder.ps1 b/vendor/psmodules/Cmder.ps1 index a2dec68df..f814a06ba 100644 --- a/vendor/psmodules/Cmder.ps1 +++ b/vendor/psmodules/Cmder.ps1 @@ -78,7 +78,8 @@ function Configure-Git($gitRoot, $gitType, $gitPathUser){ # using locally installed Git Path Config. if ($gitType -eq 'VENDOR') { # If User Git is installed replace its path config with Newer Vendored Git Path - if ($gitPathUser -ne '') { + if ($gitPathUser -ne '' -and $gitPathUser -ne $null) { + write-host "gitPathUser: $gitPathUser" # write-host "Replacing $gitPathUser with $gitRoot in the path" $gitPathUserEsc = $gitPathUser.replace('\','\\').replace('(','\(').replace(')','\)') From 80f6564851013dcb11114bc092d544f682713e17 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 6 Dec 2020 09:38:37 -0500 Subject: [PATCH 3/6] fix git fast_init --- vendor/init.bat | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 13b50ea9b..36c23d832 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -255,35 +255,34 @@ goto :CONFIGURE_GIT setlocal enabledelayedexpansion if "%GIT_INSTALL_TYPE%" equ "VENDOR" ( set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows" - if defined GIT_VERSION_USER ( - %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." + %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." - call "%cmder_root%\vendor\bin\cmder_sub_git_for_windows_path.cmd" "%CMDER_USER_GIT_PATH%" "%GIT_INSTALL_ROOT%\" - ) else ( - %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." - - :: Add git to the path - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" "" + :: Add git to the path + %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" - ) else ( - %lib_console% verbose_output "Preferring *nix commands" - set "path_position=" - ) + :: 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" + ) else ( + %lib_console% verbose_output "Preferring *nix commands" + set "path_position=" + ) - if %nix_tools% geq 1 ( - if exist "!GIT_INSTALL_ROOT!\mingw32" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! - ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position! - ) - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" !path_position! + if %nix_tools% geq 1 ( + if exist "!GIT_INSTALL_ROOT!\mingw32" ( + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! + ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position! ) + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" !path_position! ) +) else if defined GIT_VERSION_USER ( + %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." + + call "%cmder_root%\vendor\bin\cmder_sub_git_for_windows_path.cmd" "%CMDER_USER_GIT_PATH%" "%GIT_INSTALL_ROOT%\" ) + endlocal & set GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT% & set path=%path% :: define SVN_SSH so we can use git svn with ssh svn repositories From b03cca4901bb7ad3f081df50fdce36f453f16bb1 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 6 Dec 2020 09:55:30 -0500 Subject: [PATCH 4/6] revert --- vendor/init.bat | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 36c23d832..964195af0 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -232,9 +232,9 @@ set git_executable= REM echo Git User Path XXX: %CMDER_USER_GIT_PATH% :: our last hope: our own git... -:VENDORED_GIT REM if exist "%CMDER_ROOT%\vendor\git-for-windows" ( if not defined GIT_INSTALL_ROOT if defined GIT_VERSION_VENDORED ( + :VENDORED_GIT set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows" set GIT_INSTALL_TYPE=VENDOR %lib_console% debug_output "Newer user Git NOT found using vendored Git '%GIT_VERSION_VENDORED%'..." @@ -255,34 +255,35 @@ goto :CONFIGURE_GIT setlocal enabledelayedexpansion if "%GIT_INSTALL_TYPE%" equ "VENDOR" ( set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows" - %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." + if defined GIT_VERSION_USER ( + %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." - :: Add git to the path - %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" + call "%cmder_root%\vendor\bin\cmder_sub_git_for_windows_path.cmd" "%CMDER_USER_GIT_PATH%" "%GIT_INSTALL_ROOT%\" ) else ( - %lib_console% verbose_output "Preferring *nix commands" - set "path_position=" - ) + %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." + + :: Add git to the path + %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" + ) else ( + %lib_console% verbose_output "Preferring *nix commands" + set "path_position=" + ) - if %nix_tools% geq 1 ( - if exist "!GIT_INSTALL_ROOT!\mingw32" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! - ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position! + if %nix_tools% geq 1 ( + if exist "!GIT_INSTALL_ROOT!\mingw32" ( + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! + ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position! + ) + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" !path_position! ) - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" !path_position! ) -) else if defined GIT_VERSION_USER ( - %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." - - call "%cmder_root%\vendor\bin\cmder_sub_git_for_windows_path.cmd" "%CMDER_USER_GIT_PATH%" "%GIT_INSTALL_ROOT%\" ) - endlocal & set GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT% & set path=%path% :: define SVN_SSH so we can use git svn with ssh svn repositories From 9bddbfc672de45b20c33e2bdad4e3360b76accdd Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 6 Dec 2020 10:05:01 -0500 Subject: [PATCH 5/6] fix --- vendor/init.bat | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 964195af0..84eefd276 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -255,34 +255,32 @@ goto :CONFIGURE_GIT setlocal enabledelayedexpansion if "%GIT_INSTALL_TYPE%" equ "VENDOR" ( set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows" - if defined GIT_VERSION_USER ( - %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." + if %debug_output% gtr 0 call "%CMDERR_BIN%\cmder_debug_output.cmd" "Using Git from '!GIT_INSTALL_ROOT!..." - call "%cmder_root%\vendor\bin\cmder_sub_git_for_windows_path.cmd" "%CMDER_USER_GIT_PATH%" "%GIT_INSTALL_ROOT%\" - ) else ( - %lib_console% debug_output "Using Git from '!GIT_INSTALL_ROOT!..." - - :: Add git to the path - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" "" + :: Add git to the path + call "%CMDERR_BIN%\cmder_enhance_path.cmd" "!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" - ) else ( - %lib_console% verbose_output "Preferring *nix commands" - set "path_position=" - ) + :: Add the unix commands at the end to not shadow windows commands like more + if %nix_tools% equ 1 ( + call "%CMDERR_BIN%\cmder_verbose_output.cmd" "Preferring Windows commands" + set "path_position=append" + ) else ( + call "%CMDERR_BIN%\cmder_verbose_output.cmd" "Preferring *nix commands" + set "path_position=" + ) - if %nix_tools% geq 1 ( - if exist "!GIT_INSTALL_ROOT!\mingw32" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! - ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position! - ) - %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" !path_position! + if %nix_tools% geq 1 ( + if exist "!GIT_INSTALL_ROOT!\mingw32" ( + call "%CMDERR_BIN%\cmder_enhance_path.cmd" "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! + ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( + call "%CMDERR_BIN%\cmder_enhance_path.cmd" "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position! ) + call "%CMDERR_BIN%\cmder_enhance_path.cmd" "!GIT_INSTALL_ROOT!\usr\bin" !path_position! ) +) else if defined GIT_VERSION_USER ( + if %debug_output% gtr 0 call "%CMDERR_BIN%\cmder_debug_output.cmd" "Using Git from '!GIT_INSTALL_ROOT!..." + + call "%cmder_root%\vendor\bin\cmder_sub_git_for_windows_path.cmd" "%CMDER_USER_GIT_PATH%" "%GIT_INSTALL_ROOT%\" ) endlocal & set GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT% & set path=%path% From 313a32a59657f1a4004582fba9e2120b2ab84243 Mon Sep 17 00:00:00 2001 From: dgames Date: Sun, 6 Dec 2020 10:50:25 -0500 Subject: [PATCH 6/6] fixes --- vendor/init.bat | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vendor/init.bat b/vendor/init.bat index 84eefd276..c68196611 100644 --- a/vendor/init.bat +++ b/vendor/init.bat @@ -258,24 +258,24 @@ if "%GIT_INSTALL_TYPE%" equ "VENDOR" ( if %debug_output% gtr 0 call "%CMDERR_BIN%\cmder_debug_output.cmd" "Using Git from '!GIT_INSTALL_ROOT!..." :: Add git to the path - call "%CMDERR_BIN%\cmder_enhance_path.cmd" "!GIT_INSTALL_ROOT!\cmd" "" + %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 ( - call "%CMDERR_BIN%\cmder_verbose_output.cmd" "Preferring Windows commands" + %lib_console% verbose_output "Preferring Windows commands" set "path_position=append" ) else ( - call "%CMDERR_BIN%\cmder_verbose_output.cmd" "Preferring *nix commands" + %lib_console% verbose_output "Preferring *nix commands" set "path_position=" ) if %nix_tools% geq 1 ( if exist "!GIT_INSTALL_ROOT!\mingw32" ( - call "%CMDERR_BIN%\cmder_enhance_path.cmd" "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position! ) else if exist "!GIT_INSTALL_ROOT!\mingw64" ( - call "%CMDERR_BIN%\cmder_enhance_path.cmd" "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position! + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position! ) - call "%CMDERR_BIN%\cmder_enhance_path.cmd" "!GIT_INSTALL_ROOT!\usr\bin" !path_position! + %lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" !path_position! ) ) else if defined GIT_VERSION_USER ( if %debug_output% gtr 0 call "%CMDERR_BIN%\cmder_debug_output.cmd" "Using Git from '!GIT_INSTALL_ROOT!..."