1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-17 02:00:07 +00:00

make git-is-slow stickier

This commit is contained in:
romkatv 2019-03-11 18:20:39 +01:00
parent 7d7a3404dc
commit 14366ed0ce

View file

@ -1749,8 +1749,12 @@ typeset -fH _p9k_vcs_render() {
typeset -fH _p9k_vcs_resume() { typeset -fH _p9k_vcs_resume() {
if [[ $VCS_STATUS_RESULT == ok-async ]]; then if [[ $VCS_STATUS_RESULT == ok-async ]]; then
local slow=$((EPOCHREALTIME - _P9K_GITSTATUS_START_TIME > POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS)) local latency=$((EPOCHREALTIME - _P9K_GITSTATUS_START_TIME))
_P9K_GIT_SLOW[$VCS_STATUS_WORKDIR]=$slow if (( latency > POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS )); then
_P9K_GIT_SLOW[$VCS_STATUS_WORKDIR]=1
elif (( latency < 0.8 * POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS )); then # 0.8 to avoid flip-flopping
_P9K_GIT_SLOW[$VCS_STATUS_WORKDIR]=0
fi
fi fi
if [[ -z $_P9K_NEXT_VCS_DIR ]]; then if [[ -z $_P9K_NEXT_VCS_DIR ]]; then