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
57
vendor/clink.lua
vendored
57
vendor/clink.lua
vendored
@ -280,6 +280,24 @@ local function get_svn_status()
|
|||||||
return true
|
return true
|
||||||
end
|
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()
|
local function git_prompt_filter()
|
||||||
|
|
||||||
-- Colors for git status
|
-- Colors for git status
|
||||||
@ -290,27 +308,30 @@ local function git_prompt_filter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
local git_dir = get_git_dir()
|
local git_dir = get_git_dir()
|
||||||
if git_dir then
|
|
||||||
-- if we're inside of git repo then try to detect current branch
|
|
||||||
local branch = get_git_branch(git_dir)
|
|
||||||
local color
|
|
||||||
if branch then
|
|
||||||
-- Has branch => therefore it is a git folder, now figure out status
|
|
||||||
local gitStatus = get_git_status()
|
|
||||||
local gitConflict = get_git_conflict()
|
|
||||||
|
|
||||||
color = colors.dirty
|
if get_git_status_setting() then
|
||||||
if gitStatus then
|
if git_dir then
|
||||||
color = colors.clean
|
-- if we're inside of git repo then try to detect current branch
|
||||||
end
|
local branch = get_git_branch(git_dir)
|
||||||
|
local color
|
||||||
|
if branch then
|
||||||
|
-- Has branch => therefore it is a git folder, now figure out status
|
||||||
|
local gitStatus = get_git_status()
|
||||||
|
local gitConflict = get_git_conflict()
|
||||||
|
|
||||||
if gitConflict then
|
color = colors.dirty
|
||||||
color = colors.conflict
|
if gitStatus then
|
||||||
end
|
color = colors.clean
|
||||||
|
end
|
||||||
|
|
||||||
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")")
|
if gitConflict then
|
||||||
return false
|
color = colors.conflict
|
||||||
end
|
end
|
||||||
|
|
||||||
|
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- No git present or not in git file
|
-- No git present or not in git file
|
||||||
|
Loading…
Reference in New Issue
Block a user