mirror of
https://github.com/cmderdev/cmder.git
synced 2025-02-10 23:49:07 +08:00
add ability to disable git
This commit is contained in:
parent
b70a03cde0
commit
44a8bf5802
21
vendor/clink.lua
vendored
21
vendor/clink.lua
vendored
@ -280,6 +280,24 @@ local function get_svn_status()
|
||||
return true
|
||||
end
|
||||
|
||||
---
|
||||
-- Get the status of working dir
|
||||
-- @return {bool}
|
||||
---
|
||||
local function get_git_status_setting()
|
||||
gitStatusSetting = io.popen("git config cmder.status")
|
||||
|
||||
for line in gitStatusSetting:lines() do
|
||||
if string.match(line, 'false') then
|
||||
gitStatusSetting:close()
|
||||
return false
|
||||
end
|
||||
end
|
||||
gitStatusSetting:close()
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local function git_prompt_filter()
|
||||
|
||||
-- Colors for git status
|
||||
@ -290,6 +308,8 @@ local function git_prompt_filter()
|
||||
}
|
||||
|
||||
local git_dir = get_git_dir()
|
||||
|
||||
if get_git_status_setting() then
|
||||
if git_dir then
|
||||
-- if we're inside of git repo then try to detect current branch
|
||||
local branch = get_git_branch(git_dir)
|
||||
@ -312,6 +332,7 @@ local function git_prompt_filter()
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- No git present or not in git file
|
||||
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", "")
|
||||
|
Loading…
Reference in New Issue
Block a user