summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarc Cornellà <marc@mcornella.com>2024-06-12 10:32:30 +0200
committerMarc Cornellà <marc@mcornella.com>2024-06-12 10:32:30 +0200
commit59e8e028e179fc126d46254900946953072048e7 (patch)
tree5a4e9268a87229dda390ec28cc15f847cd5f9f89 /lib
parent4295aed17b4b1180b7e42bd7debd7685686c1307 (diff)
downloadzsh-59e8e028e179fc126d46254900946953072048e7.tar.gz
zsh-59e8e028e179fc126d46254900946953072048e7.tar.bz2
zsh-59e8e028e179fc126d46254900946953072048e7.zip
fix(lib/git): turn off async prompt for zsh < 5.0.6
We removed this mitigation in 0c80a063 because of an assumption that the issue had been fixed, but it looks like zsh < 5.0.6 has other issues (see #12360), so we need to disable it for real. Fixes #12360
Diffstat (limited to 'lib')
-rw-r--r--lib/git.zsh9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/git.zsh b/lib/git.zsh
index b257d01a4..db6c9174c 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -39,8 +39,13 @@ function _omz_git_prompt_info() {
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
}
-# Use async version if setting is enabled or undefined
-if zstyle -T ':omz:alpha:lib:git' async-prompt; then
+# Use async version if setting is enabled, or unset but zsh version is at least 5.0.6.
+# This avoids async prompt issues caused by previous zsh versions:
+# - https://github.com/ohmyzsh/ohmyzsh/issues/12331
+# - https://github.com/ohmyzsh/ohmyzsh/issues/12360
+# TODO(2024-06-12): @mcornella remove workaround when CentOS 7 reaches EOL
+if zstyle -t ':omz:alpha:lib:git' async-prompt \
+ || { is-at-least 5.0.6 && zstyle -T ':omz:alpha:lib:git' async-prompt }; then
function git_prompt_info() {
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" ]]; then
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}"