Skip to content

Commit d45651f

Browse files
committed
Merge branch 'master' of https://github.com/cmderdev/cmder into development
2 parents bb14aea + 75d6973 commit d45651f

7 files changed

Lines changed: 54 additions & 36 deletions

File tree

.github/workflows/branches.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
# Steps represent a sequence of tasks that will be executed as part of the job
2020
steps:
2121
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v5
2323
with:
2424
fetch-depth: 0 # fetch all history for all branches and tags
2525

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
discussions: write
3636
steps:
3737
- name: Check out repository code (Action from GitHub)
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@v5
3939
with:
4040
fetch-depth: 0
4141

@@ -93,26 +93,26 @@ jobs:
9393
name: cmder_wt_mini.zip
9494

9595
- name: Upload artifact (cmder.zip)
96-
uses: actions/upload-artifact@v4
96+
uses: actions/upload-artifact@v5
9797
with:
9898
path: build/cmder.zip
9999
name: cmder.zip
100100
if-no-files-found: error
101101

102102
- name: Upload artifact (cmder.7z)
103-
uses: actions/upload-artifact@v4
103+
uses: actions/upload-artifact@v5
104104
with:
105105
path: build/cmder.7z
106106
name: cmder.7z
107107

108108
- name: Upload artifact (cmder_mini.zip)
109-
uses: actions/upload-artifact@v4
109+
uses: actions/upload-artifact@v5
110110
with:
111111
path: build/cmder_mini.zip
112112
name: cmder_mini.zip
113113

114114
- name: Upload artifact (hashes.txt)
115-
uses: actions/upload-artifact@v4
115+
uses: actions/upload-artifact@v5
116116
with:
117117
path: build/hashes.txt
118118
name: hashes.txt

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ jobs:
4545

4646
steps:
4747
- name: Checkout repository
48-
uses: actions/checkout@v4
48+
uses: actions/checkout@v5
4949

5050
# Initializes the CodeQL tools for scanning.
5151
- name: Initialize CodeQL
52-
uses: github/codeql-action/init@v3
52+
uses: github/codeql-action/init@v4
5353
with:
5454
languages: ${{ matrix.language }}
5555
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,6 +68,6 @@ jobs:
6868
run: .\build.ps1 -Compile -verbose
6969

7070
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v3
71+
uses: github/codeql-action/analyze@v4
7272
with:
7373
category: "/language:${{matrix.language}}"

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
continue-on-error: false
3939

4040
steps:
41-
- uses: actions/checkout@v4
41+
- uses: actions/checkout@v5
4242
- name: Initialize vendors
4343
shell: pwsh
4444
working-directory: scripts

.github/workflows/vendor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
pull-requests: write
2525

2626
steps:
27-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@v5
2828
with:
2929
fetch-depth: 0
3030

vendor/git-prompt.sh

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
1+
# Returns 1 if git status for Cmder is disabled, otherwise returns 0
12
function getGitStatusSetting() {
2-
gitStatusSetting=$(git --no-pager config -l 2>/dev/null)
3+
local gitConfig
34

4-
if [[ -n ${gitStatusSetting} ]] && [[ ${gitStatusSetting} =~ cmder.status=false ]] || [[ ${gitStatusSetting} =~ cmder.shstatus=false ]]
5+
# Get all git config entries for the current repository without pager
6+
gitConfig=$(git --no-pager config -l 2>/dev/null) || return 0 # treat failure as enabled
7+
8+
# Check if git status for Cmder is disabled
9+
if [[ $gitConfig =~ (^|$'\n')cmder\.status=false($|$'\n') ]] || \
10+
[[ $gitConfig =~ (^|$'\n')cmder\.shstatus=false($|$'\n') ]]
511
then
6-
echo false
7-
else
8-
echo true
12+
return 1 # disabled
913
fi
14+
15+
return 0
1016
}
1117

18+
# Prints current branch or detached HEAD short commit hash
1219
function getSimpleGitBranch() {
13-
gitDir=$(git rev-parse --git-dir 2>/dev/null)
14-
if [ -z "$gitDir" ]; then
15-
return 0
16-
fi
20+
local gitDir
21+
gitDir=$(git rev-parse --git-dir 2>/dev/null) || return 0
22+
23+
local headFile="$gitDir/HEAD"
24+
[ -f "$headFile" ] || return 0
1725

18-
headContent=$(< "$gitDir/HEAD")
19-
if [[ "$headContent" == "ref: refs/heads/"* ]]
26+
local headContent
27+
headContent=$(< "$headFile")
28+
if [[ "$headContent" =~ ^ref:\ refs/heads/(.+)$ ]]
2029
then
21-
echo " (${headContent:16})"
30+
echo " (${BASH_REMATCH[1]})"
2231
else
2332
echo " (HEAD detached at ${headContent:0:7})"
2433
fi
@@ -33,18 +42,18 @@ fi
3342

3443
if test -f ~/.config/git/git-prompt.sh
3544
then
36-
if [[ $(getGitStatusSetting) == true ]]
45+
if getGitStatusSetting
3746
then
3847
. ~/.config/git/git-prompt.sh
3948
fi
4049
else
41-
# Taken from https://github.com/git-for-windows/build-extra/blob/main/git-extra/git-prompt.sh
42-
PS1='\[\033]0;$TITLEPREFIX:${PWD//[^[:ascii:]]/?}\007\]' # set window title
50+
# Taken parts from https://github.com/git-for-windows/build-extra/blob/main/git-extra/git-prompt.sh
51+
PS1='\[\033]0;${TITLEPREFIX:+$TITLEPREFIX:}${PWD//[^[:ascii:]]/?}\007\]' # set window title to TITLEPREFIX (if set) and current working directory
4352
# PS1="$PS1"'\n' # new line (disabled)
44-
PS1="$PS1"'\[\033[32m\]' # change to green
53+
PS1="$PS1"'\[\033[32m\]' # change to green and bold
4554
PS1="$PS1"'\u@\h ' # user@host<space>
4655
PS1="$PS1${MSYSTEM:+\[\033[35m\]$MSYSTEM }" # show MSYSTEM in purple (if set)
47-
PS1="$PS1"'\[\033[33m\]' # change to brownish yellow
56+
PS1="$PS1"'\[\033[1;33m\]' # change to dark yellow in bold
4857
PS1="$PS1"'\w' # current working directory
4958
if test -z "$WINELOADERNOEXEC"
5059
then
@@ -55,7 +64,7 @@ else
5564
if test -f "$COMPLETION_PATH/git-prompt.sh"
5665
then
5766
. "$COMPLETION_PATH/git-completion.bash"
58-
if [[ $(getGitStatusSetting) == true ]]
67+
if getGitStatusSetting
5968
then
6069
. "$COMPLETION_PATH/git-prompt.sh"
6170
PS1="$PS1"'\[\033[36m\]' # change color to cyan
@@ -66,9 +75,11 @@ else
6675
fi
6776
fi
6877
fi
69-
PS1="$PS1"'\[\033[0m\]' # change color
78+
PS1="$PS1"'\[\033[0m\]' # reset color
7079
PS1="$PS1"'\n' # new line
80+
PS1="$PS1"'\[\033[30;1m\]' # change color to grey in bold
7181
PS1="$PS1"'λ ' # prompt: Cmder uses λ
82+
PS1="$PS1"'\[\033[0m\]' # reset color
7283
fi
7384

7485
MSYS2_PS1="$PS1" # for detection by MSYS2 SDK's bash.basrc
@@ -82,4 +93,4 @@ then
8293
test ! -f "$c" ||
8394
. "$c"
8495
done
85-
fi
96+
fi

vendor/lib/lib_path.cmd

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,18 @@ exit /b
127127
exit /b
128128

129129
:toolong
130-
echo "%OLD_PATH%">"%temp%\cmder_lib_pathA"
131-
echo "%PATH%">"%temp%\cmder_lib_pathB"
132-
fc /b "%temp%\cmder_lib_pathA" "%temp%\cmder_lib_pathB" 2>nul 1>nul
133-
if errorlevel 1 ( del "%temp%\cmder_lib_pathA" & del "%temp%\cmder_lib_pathB" & goto :changed )
134-
del "%temp%\cmder_lib_pathA" & del "%temp%\cmder_lib_pathB"
130+
set "_rand=%RANDOM%"
131+
if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" 2>nul 1>nul
132+
if exist "%temp%\%_rand%_cmder_lib_pathB" del "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul
133+
if exist "%temp%\%_rand%_cmder_lib_pathA" goto :toolong
134+
if exist "%temp%\%_rand%_cmder_lib_pathB" goto :toolong
135+
echo "%OLD_PATH%">"%temp%\%_rand%_cmder_lib_pathA"
136+
if errorlevel 1 ( if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" & goto :toolong )
137+
echo "%PATH%">"%temp%\%_rand%_cmder_lib_pathB"
138+
if errorlevel 1 ( if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" & if exist "%temp%\%_cmder_lib_pathB" del "%temp%\%_rand%_cmder_lib_pathB" & goto :toolong )
139+
fc /b "%temp%\%_rand%_cmder_lib_pathA" "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul
140+
if errorlevel 1 ( del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand=" & goto :changed )
141+
del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand="
135142
exit /b
136143

137144
:changed

0 commit comments

Comments
 (0)