1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-25 21:40:08 +00:00

bug fixes in the gitstatus fastpath

This commit is contained in:
romkatv 2020-02-24 11:23:56 +01:00
parent 298169f042
commit 0d8e001f27

View file

@ -3736,9 +3736,9 @@ function _p9k_vcs_gitstatus() {
unset VCS_STATUS_RESULT unset VCS_STATUS_RESULT
return 1 return 1
fi fi
typeset -gF _p9k__vcs_timeout=timeout
_p9k__gitstatus_next_dir='' _p9k__gitstatus_next_dir=''
_p9k__gitstatus_start_time=$EPOCHREALTIME _p9k__gitstatus_start_time=$EPOCHREALTIME
typeset -g _p9k__vcs=
return 0 return 0
fi fi
if ! gitstatus_query -d $_p9k__cwd_a -t $timeout -c '_p9k_vcs_resume 1' POWERLEVEL9K; then if ! gitstatus_query -d $_p9k__cwd_a -t $timeout -c '_p9k_vcs_resume 1' POWERLEVEL9K; then
@ -6045,7 +6045,9 @@ _p9k_precmd_impl() {
__p9k_reset_state=1 __p9k_reset_state=1
if (( _p9k_vcs_index && $+GITSTATUS_DAEMON_PID_POWERLEVEL9K )); then if (( _p9k_vcs_index && $+GITSTATUS_DAEMON_PID_POWERLEVEL9K )); then
local -F start_time=EPOCHREALTIME
unset _p9k__vcs unset _p9k__vcs
unset _p9k__vcs_timeout
_p9k_vcs_gitstatus _p9k_vcs_gitstatus
fi fi
@ -6074,8 +6076,11 @@ _p9k_precmd_impl() {
fi fi
if (( _p9k_vcs_index && $+GITSTATUS_DAEMON_PID_POWERLEVEL9K )); then if (( _p9k_vcs_index && $+GITSTATUS_DAEMON_PID_POWERLEVEL9K )); then
# TODO: use better timeout if (( $+_p9k__vcs_timeout )); then
gitstatus_process_results -t $_POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS POWERLEVEL9K (( _p9k__vcs_timeout = _POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS + start_time - EPOCHREALTIME ))
(( _p9k__vcs_timeout >= 0 )) || (( _p9k__vcs_timeout = 0 ))
gitstatus_process_results -t $_p9k__vcs_timeout POWERLEVEL9K
fi
if (( ! $+_p9k__vcs )); then if (( ! $+_p9k__vcs )); then
local _p9k__prompt _p9k__prompt_side=$_p9k_vcs_side local _p9k__prompt _p9k__prompt_side=$_p9k_vcs_side
local -i _p9k__has_upglob _p9k__segment_index=_p9k_vcs_index local -i _p9k__has_upglob _p9k__segment_index=_p9k_vcs_index
@ -6591,6 +6596,7 @@ _p9k_init_params() {
# If it takes longer than this to fetch git repo status, display the prompt with a greyed out # If it takes longer than this to fetch git repo status, display the prompt with a greyed out
# vcs segment and fix it asynchronously when the results come it. # vcs segment and fix it asynchronously when the results come it.
_p9k_declare -F POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS 0.02 _p9k_declare -F POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS 0.02
(( POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS >= 0 )) || (( POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS = 0 ))
_p9k_declare -a POWERLEVEL9K_VCS_BACKENDS -- git _p9k_declare -a POWERLEVEL9K_VCS_BACKENDS -- git
_p9k_declare -b POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING 0 _p9k_declare -b POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING 0
_p9k_declare -i POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY -1 _p9k_declare -i POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY -1