Compare commits

..

33 Commits

Author SHA1 Message Date
a1785415fd Merge pull request #2359 from daxgames/changelog
Changelog
2020-07-29 20:43:32 -04:00
794ae2ad60 changelog 2020-07-29 20:42:14 -04:00
28c416a15c changelog 2020-07-29 20:41:29 -04:00
70aa573111 changelog 2020-07-29 20:39:37 -04:00
4cacd2fdc8 Merge pull request #2358 from FloSchwalm/update-to-git-2.28
Update git for windows to 2.28.0
2020-07-29 20:28:25 -04:00
80f76ad956 Merge pull request #2357 from FloSchwalm/fix-git-version-comparison
Fix git version comparison
2020-07-29 20:27:23 -04:00
906bb5d357 Merge pull request #2339 from daxgames/fix_global_vars_vscode_err
1.3.16-pre: 1.3.15 Fixes
2020-07-29 19:33:12 -04:00
29d784b2b1 Update git for windows to 2.28.0 2020-07-29 22:58:30 +02:00
fc90722faa Prepend %GIT_INSTALL_ROOT%\cmd to path instead of appending it
The default setting for path enhancing is appending,
so the provided unix tools don't overwrite windows tools we may want to keep.
For Git this is undesired behavior, though, as we just compared git versions
to decide which one we want to use. The git directory thus needs to be prepended
to the path to make sure a call to git uses the version we selected.
2020-07-29 22:48:01 +02:00
167c49ee6d Rewrite old calls to :verbose_output to working %lib_console% verbose_output 2020-07-29 22:46:35 +02:00
0ed10e5e89 Reorder if-else-clauses in :compare_git_versions so last else block can be reached
It is hard to spot without the brackets, but the last else block - that resets %test_dir% and
logs in verbose mode that an older user git version will be ignored - can't actually be reached.
The else block is considered to belong to the if clause "if exist "%test_dir:~0,-4%\cmd\git.exe""
that will only ever be executed if ERRORLEVEL is greather than or equal to 0, thus if the test fails,
the following else if clause "else if ERRORLEVEL 0" will always succeed and the last else block will be ignored.
Using the vendored git version may still have worked because %GIT_INSTALL_ROOT% isn't set either way,
but to enable the log message I reordered if-else-clauses and brackets in the way I think the
original author intended them to work.
2020-07-29 22:39:46 +02:00
cd50db3a7f Use ERRORLEVEL instead of %errorlevel% to compare git versions
%errorlevel% was always 0, even if the vendored git version was more current than the installed one
Usually exiting a batch script with "exit /b exitCode" as used in :compare_versions
sets %errorlevel% to the specified exit code
However, this may not work if %errorlevel% was set before with "Set errorlevel="
I didn't find the location where this might have happened,
but I saw the consequence of %errorlevel% always being 0
Thus I decided to use ERRORLEVEL instead as this will always work regardless of environment variable

For more information check https://ss64.com/nt/errorlevel.html
2020-07-29 22:25:49 +02:00
37a223b449 fix lib_path 2020-07-25 05:11:34 -04:00
334838c079 Update init.bat 2020-07-24 08:34:45 -04:00
0c3d89925e 'fix 2020-07-23 13:41:10 -04:00
020661af95 Merge branch 'fix_global_vars_vscode_err' of https://github.com/daxgames/cmder into fix_global_vars_vscode_err 2020-07-23 13:39:46 -04:00
79261d4d27 fix 2020-07-23 13:36:50 -04:00
7326a3cfc5 Update init.bat 2020-07-23 13:34:13 -04:00
fdcbd6df87 Delete vscode_init_args.cmd 2020-07-23 08:43:09 -04:00
0c41d5f5d4 Merge pull request #2351 from famoses/patch-1
quote time measures for timer.cmd
2020-07-18 08:58:53 -04:00
40c58417b2 quote time measures for timer.cmd
The startup time duration is calculated wrongly ( at least for me, on Windows 1909, with CmderMini 1.3.15.1010 ). I got something like "Elapsed Time: 80:36:1.00 (290161.00s total)" printed into the cmder consle window. I can be solved by quoting the time measures taken in `init.bat`. 

It seems that `time.cmd` fails in recognizing two arguments. In fact it did split the first time measure into two arguments and ignored the second time measure.
Example: 
from the two time measures
λ echo %CMDER_INIT_START% %CMDER_INIT_END%
12:53:44,34 12:53:54,04
The call to `time.cmd` created following output (i added echo commands to print variables start and end right after they got assigned the arguments)
start: 12:53:44
end:   34
2020-07-18 13:32:22 +02:00
97a41ddd99 fix cmder_configured GTR 1 2020-07-14 22:31:57 -04:00
954937cf97 cleanup 2020-07-05 15:22:09 -04:00
2c620d1d67 cleanup 2020-07-05 15:13:23 -04:00
5e7a7029d1 make vscode_init.cmd smart enough to apply cmder settings if launched from inside or outside cmder 2020-07-04 14:23:16 -04:00
f1c1354c00 make vscode_init.cmd smart enough to apply cmder settings if launched from inside or outside cmder 2020-07-04 13:43:18 -04:00
0f12de345b Update init.bat 2020-07-02 07:00:25 -04:00
c332ab1a34 Fix bug introduced in 1.3.15 2020-07-01 16:24:36 -04:00
4403edb110 Update init.bat 2020-07-01 08:26:44 -04:00
00bc5439fd Merge branch 'fix_git' into fix_global_vars_vscode_err 2020-06-29 07:51:31 -04:00
da5f1bc4db fix git detect 2020-06-29 07:49:22 -04:00
52f5ad62c3 changelog 2020-06-26 22:29:26 -04:00
250ae06e7a fix vscode terminal errors when setting cmder fast_init=1 outside cmder 2020-06-26 22:27:29 -04:00
10 changed files with 133 additions and 30 deletions

View File

@ -1,5 +1,16 @@
# Change Log
## [1.3.16](https://github.com/cmderdev/cmder/tree/v1.3.16) (2020-07-29)
### Fixes
* Merge pull request #2357 from FloSchwalm/fix-git-version-comparison [Dax T Games]
* Merge pull request #2339 from daxgames/fix_global_vars_vscode_err [Dax T Games]
### Changes
* Merge pull request #2358 from FloSchwalm/update-to-git-2.28 [Dax T Games]
## [1.3.15](https://github.com/cmderdev/cmder/tree/v1.3.15) (2020-06-26)
* Fixes #2247, fixes #2254 [#2265](https://github.com/cmderdev/cmder/pull/2265)

View File

@ -7,7 +7,7 @@ If you follow them your contribution will likely be pulled in quicker.
## Getting Started
* Fork the repository on GitHub (It's that easy)
* Create a feature branch based on the development branch.
* Create a feature branch based on the `master` branch.
## Making Changes

View File

@ -1,4 +1,26 @@
@echo off
:: Find root dir
if not defined CMDER_ROOT (
for /f "delims=" %%i in ("%~dp0\..\..") do (
set "cmder_root=%%~fi"
)
)
if defined cmder_user_bin (
set CMDER_VSCODE_INIT_ARGS=%cmder_user_bin%\vscode_init_args.cmd
) else (
set CMDER_VSCODE_INIT_ARGS=%CMDER_ROOT%\bin\vscode_init_args.cmd
)
if not exist "%CMDER_VSCODE_INIT_ARGS%" (
echo Creating initial "%CMDER_VSCODE_INIT_ARGS%"...
copy "%CMDER_ROOT%\vendor\bin\vscode_init_args.cmd.default" "%CMDER_VSCODE_INIT_ARGS%"
) else (
call "%CMDER_VSCODE_INIT_ARGS%"
)
IF [%1] == [] (
REM -- manually opened console (Ctrl + Shift + `) --
CALL "%~dp0..\init.bat"

58
vendor/bin/vscode_init_args.cmd.default vendored Normal file
View File

@ -0,0 +1,58 @@
@echo off
:: Below are the default Cmder session settings:
::
:: See "%CMDER_ROOT%\README.md" for details on these settings.
::
:: `Cmder.exe` Arguments:
:: ----------------------
::
:: `/c [cmder_user_cfg_root]
:: set cmder_user_bin=[cmder_user_cfg_root]\bin
:: set cmder_user_config=[cmder_user_cfg_root]\config
::
:: `init.bat` Arguments
:: --------------------
::
:: `/d`
:: debug_output=0
::
:: `/v`
:: verbose_output=0
::
:: `/f`
:: fast_init=0
::
:: `/nix_tools`
:: nix_tools=1
::
:: `/t`
:: time_init=0
::
:: `/max_depth`
:: max_depth=1
::
:: `/user_aliases`
:: user_aliases=
::
:: `/git_install_root`
:: GIT_INSTALL_ROOT=
::
:: `/home`
:: HOME=
::
:: `/svn_ssh`
:: SVN_SSH=
echo Applying Cmder VSCode settings from '%~0'...
if defined CMDER_CONFIGURED (
:: Set Cmder settings here for when VSCode is launched inside Cmder.
set verbose_output=1
) else (
:: Set Cmder settings here for when VSCode is launched from outside Cmder.
set verbose_output=1
)
:: Set all required Cmder VSCode terminal environment settings above this line.
echo Applying Cmder VSCode settings is complete!

34
vendor/init.bat vendored
View File

@ -166,10 +166,14 @@ if "%CMDER_CLINK%" == "1" (
%lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!"
)
if "%CMDER_CONFIGURED%" == "1" (
echo Cmder is already configured, skipping Cmder Init!
if "%CMDER_CONFIGURED%" GTR "1" (
%lib_console% verbose_output "Cmder is already configured, skipping Cmder Init!"
goto CMDER_CONFIGURED
goto USER_ALIASES
) else if "%CMDER_CONFIGURED%" == "1" (
%lib_console% verbose_output "Cmder is already configured, skipping to Cmder User Init!"
goto USER_CONFIG_START
)
:: Prepare for git-for-windows
@ -204,10 +208,10 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do (
%lib_git% is_git_shim "%%~dpF"
%lib_git% get_user_git_version
%lib_git% compare_git_versions
)
if defined GIT_INSTALL_ROOT (
goto :FOUND_GIT
if defined GIT_INSTALL_ROOT (
goto :FOUND_GIT
)
)
:: our last hope: our own git...
@ -231,16 +235,17 @@ 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% debug_output init.bat "Preferring Windows commands"
%lib_console% verbose_output "Preferring Windows commands"
set "path_position=append"
) else (
%lib_console% debug_output init.bat "Preferring *nix commands"
%lib_console% verbose_output "Preferring *nix commands"
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%
@ -294,6 +299,7 @@ if defined CMDER_USER_CONFIG (
%lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d"
)
:USER_ALIASES
:: Allows user to override default aliases store using profile.d
:: scripts run above by setting the 'aliases' env variable.
::
@ -338,6 +344,8 @@ if "%CMDER_ALIASES%" == "1" (
:: Add aliases to the environment
call "%user_aliases%"
if "%CMDER_CONFIGURED%" gtr "1" goto CMDER_CONFIGURED
:: See vendor\git-for-windows\README.portable for why we do this
:: Basically we need to execute this post-install.bat because we are
:: manually extracting the archive rather than executing the 7z sfx
@ -363,7 +371,7 @@ if defined CMDER_USER_CONFIG (
set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd"
if exist "%CMDER_USER_CONFIG%\user_profile.cmd" (
REM Create this file and place your own command in there
%lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd
%lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd"
call "%CMDER_USER_CONFIG%\user_profile.cmd"
)
)
@ -389,11 +397,11 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD
set initialConfig=
:CMDER_CONFIGURED
set CMDER_CONFIGURED=1
if not defined CMDER_CONFIGURED set CMDER_CONFIGURED=1
set CMDER_INIT_END=%time%
if %time_init% gtr 0 (
"%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END%
"%cmder_root%\vendor\bin\timer.cmd" "%CMDER_INIT_START%" "%CMDER_INIT_END%"
)
exit /b

View File

@ -1,10 +1,10 @@
@echo off
if "%fast_init%" == "1" exit /b
call "%~dp0lib_base.cmd"
set lib_console=call "%~dp0lib_console.cmd"
if "%fast_init%" == "1" exit /b
if "%~1" == "/h" (
%lib_base% help "%~0"
) else if "%1" neq "" (

View File

@ -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" (
set "GIT_INSTALL_ROOT=%test_dir:~0,-4%"
set test_dir=
) else if %errorlevel% geq 0 (
set "GIT_INSTALL_ROOT=%test_dir%"
set test_dir=
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 (
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=
)
)

View File

@ -32,6 +32,7 @@ exit /b
:::options:
:::
::: append <in> Append to the path env variable rather than pre-pend.
::B
:::
:::output:
:::
@ -168,7 +169,8 @@ exit /b
set "position="
)
dir "%add_path%" | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL
dir "%add_path%" 2>NUL | findstr -i "\.COM \.EXE \.BAT \.CMD \.PS1 \.VBS" >NUL
if "%ERRORLEVEL%" == "0" (
set "add_to_path=%add_path%"
) else (

2
vendor/profile.ps1 vendored
View File

@ -1,4 +1,4 @@
# Init Script for PowerShell
# Init Script for PowerShell
# Created as part of cmder project
# !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED

4
vendor/sources.json vendored
View File

@ -1,8 +1,8 @@
[
{
"name": "git-for-windows",
"version": "v2.26.2.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.26.2.windows.1/PortableGit-2.26.2-64-bit.7z.exe"
"version": "v2.28.0.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.28.0.windows.1/PortableGit-2.28.0-64-bit.7z.exe"
},
{
"name": "clink",