From e7a6e6447384921a49cf707225177a5f55a3d6ed Mon Sep 17 00:00:00 2001 From: Chris Antos Date: Sat, 12 Jun 2021 18:56:37 -0700 Subject: [PATCH] Rewrote how `prompt_overrideGitStatusOptIn` works. It was less clear before, and it also accidentally took effect when the `prompt.async` Clink setting was off. --- vendor/clink.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vendor/clink.lua b/vendor/clink.lua index 5f3b628..f7931ad 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -74,9 +74,6 @@ local cached_info = {} if clink.promptcoroutine and io.popenyield then io_popenyield = io.popenyield clink_promptcoroutine = clink.promptcoroutine - if prompt_overrideGitStatusOptIn then - cmderForceAsyncGitStatus = true - end else io_popenyield = io.popen clink_promptcoroutine = function (func) @@ -422,6 +419,15 @@ end -- @return {bool} --- 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") for line in gitStatusConfig:lines() do @@ -461,7 +467,7 @@ local function git_prompt_filter() local git_dir = get_git_dir() local color - cmderGitStatusOptIn = cmderForceAsyncGitStatus or get_git_status_setting() + cmderGitStatusOptIn = get_git_status_setting() if git_dir then local branch = get_git_branch(git_dir) if branch then