mirror of
				https://github.com/ohmyzsh/ohmyzsh.git
				synced 2025-11-04 21:31:19 +08:00 
			
		
		
		
	fix(git): turn off async prompt by default on zsh < 5.0.6 (#12331)
See https://github.com/ohmyzsh/ohmyzsh/issues/12331#issuecomment-2059460268
This commit is contained in:
		
							parent
							
								
									7ef3f49f97
								
							
						
					
					
						commit
						1ed8d4b555
					
				@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					autoload -Uz is-at-least
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# The git prompt's git commands are read-only and should not interfere with
 | 
					# The git prompt's git commands are read-only and should not interfere with
 | 
				
			||||||
# other processes. This environment variable is equivalent to running with `git
 | 
					# other processes. This environment variable is equivalent to running with `git
 | 
				
			||||||
# --no-optional-locks`, but falls back gracefully for older versions of git.
 | 
					# --no-optional-locks`, but falls back gracefully for older versions of git.
 | 
				
			||||||
@ -37,8 +39,10 @@ function _omz_git_prompt_info() {
 | 
				
			|||||||
  echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
 | 
					  echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Enable async prompt by default unless the setting is at false / no
 | 
					# Use async version if setting is enabled, or undefined but zsh version is at least 5.0.6
 | 
				
			||||||
if zstyle -T ':omz:alpha:lib:git' async-prompt; then
 | 
					# https://github.com/ohmyzsh/ohmyzsh/issues/12331#issuecomment-2059460268
 | 
				
			||||||
 | 
					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() {
 | 
					  function git_prompt_info() {
 | 
				
			||||||
    setopt localoptions noksharrays
 | 
					    setopt localoptions noksharrays
 | 
				
			||||||
    if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]" ]]; then
 | 
					    if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]" ]]; then
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user