Rewrote how prompt_overrideGitStatusOptIn works.

It was less clear before, and it also accidentally took effect when
the `prompt.async` Clink setting was off.
This commit is contained in:
Chris Antos 2021-06-12 18:56:37 -07:00
parent f6c2657b23
commit e7a6e64473

14
vendor/clink.lua vendored
View File

@ -74,9 +74,6 @@ local cached_info = {}
if clink.promptcoroutine and io.popenyield then if clink.promptcoroutine and io.popenyield then
io_popenyield = io.popenyield io_popenyield = io.popenyield
clink_promptcoroutine = clink.promptcoroutine clink_promptcoroutine = clink.promptcoroutine
if prompt_overrideGitStatusOptIn then
cmderForceAsyncGitStatus = true
end
else else
io_popenyield = io.popen io_popenyield = io.popen
clink_promptcoroutine = function (func) clink_promptcoroutine = function (func)
@ -422,6 +419,15 @@ end
-- @return {bool} -- @return {bool}
--- ---
local function get_git_status_setting() local function get_git_status_setting()
-- When async prompt filtering is available, check the
-- prompt_overrideGitStatusOptIn config setting for whether to ignore the
-- cmder.status and cmder.cmdstatus git config opt-in settings.
if clink.promptcoroutine and io.popenyield and settings.get("prompt.async") then
if prompt_overrideGitStatusOptIn then
return true
end
end
local gitStatusConfig = io.popen("git --no-pager config cmder.status 2>nul") local gitStatusConfig = io.popen("git --no-pager config cmder.status 2>nul")
for line in gitStatusConfig:lines() do for line in gitStatusConfig:lines() do
@ -461,7 +467,7 @@ local function git_prompt_filter()
local git_dir = get_git_dir() local git_dir = get_git_dir()
local color local color
cmderGitStatusOptIn = cmderForceAsyncGitStatus or get_git_status_setting() cmderGitStatusOptIn = get_git_status_setting()
if git_dir then if git_dir then
local branch = get_git_branch(git_dir) local branch = get_git_branch(git_dir)
if branch then if branch then