Skip to content

Commit 2428e85

Browse files
committed
dd per shell git opt out
1 parent 3eb82d4 commit 2428e85

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in t
184184
185185
```
186186
[cmder]
187-
status = false
187+
status = false # Opt out of Git status for 'ALL' Cmder supported shells.
188+
cmdstatus = false # Opt out of Git status for 'Cmd.exe' shells.
189+
psstatus = false # Opt out of Git status for 'Powershell.exe and 'Pwsh.exe' shells.
190+
shstatus = false # Opt out of Git status for 'bash.exe' shells.
188191
```
189192
190193
### Aliases

vendor/clink.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ end
285285
-- @return {bool}
286286
---
287287
local function get_git_status_setting()
288-
gitStatusSetting = io.popen("git config cmder.status")
288+
gitStatusSetting = io.popen("git --no-pager config -l")
289289

290290
for line in gitStatusSetting:lines() do
291-
if string.match(line, 'false') then
291+
if string.match(line, 'cmder.status=false') or string.match(line, 'cmder.cmdstatus=false') then
292292
gitStatusSetting:close()
293293
return false
294294
end

vendor/git-prompt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function getGitStatusSetting() {
2-
gitStatusSetting=$(git config cmder.status 2>/dev/null)
2+
gitStatusSetting=$(git --no-pager config -l 2>/dev/null)
33

4-
if [[ -n ${gitStatusSetting} ]] && [[ ${gitStatusSetting} == false ]]
4+
if [[ -n ${gitStatusSetting} ]] && [[ ${gitStatusSetting} =~ cmder.status=false ]] || [[ ${gitStatusSetting} =~ cmder.shstatus=false ]]
55
then
66
echo false
77
else

vendor/psmodules/Cmder.ps1

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function Configure-Git($GIT_INSTALL_ROOT){
1616
}
1717

1818
function Import-Git(){
19+
1920
$GitModule = Get-Module -Name Posh-Git -ListAvailable
2021
if($GitModule | select version | where version -le ([version]"0.6.1.20160330")){
2122
Import-Module Posh-Git > $null
@@ -46,11 +47,13 @@ function checkGit($Path) {
4647
}
4748

4849
function getGitStatusSetting() {
49-
$gitStatus = (git config cmder.status) | out-string
50+
$gitStatus = (git --no-pager config -l) | out-string
5051

51-
if (($gitStatus -replace "`n" -replace "`r") -eq "false") {
52-
return $false
53-
} else {
54-
return $true
52+
ForEach ($line in $($gitStatus -split "`r`n")) {
53+
if ($line -match 'cmder.status=false' -or $line -match 'cmder.psstatus=false') {
54+
return $false
55+
}
5556
}
57+
58+
return $true
5659
}

0 commit comments

Comments
 (0)