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

don't call stat in prompt_dir; use _p9k__parent_mtimes instead

This commit is contained in:
romkatv 2020-01-28 11:09:51 +01:00
parent 43fe2c30d1
commit 5f6d73c5ac

View file

@ -1764,13 +1764,12 @@ prompt_dir() {
elif [[ $p[1] == / ]]; then elif [[ $p[1] == / ]]; then
(( ++i )) (( ++i ))
fi fi
local parent="${_p9k__cwd%/${(pj./.)parts[i,-1]}}"
if (( i <= e )); then if (( i <= e )); then
local MATCH= mtimes=() local parent="${_p9k__cwd%/${(pj./.)parts[i,-1]}}"
zstat -A mtimes +mtime -- ${(@)${:-{$i..$e}}/(#m)*/$parent/${(pj./.)parts[i,$MATCH]}} 2>/dev/null || mtimes=() local mtimes=(${(Oa)_p9k__parent_mtimes:$(($#parts-e)):$((e-i+1))})
local key="${(pj.:.)mtimes}" local key="${(pj.:.)mtimes}"
else else
local key='good' local key=
fi fi
if ! _p9k_cache_ephemeral_get $0 $e $i $_p9k__cwd || [[ $key != $_p9k_cache_val[1] ]] ; then if ! _p9k_cache_ephemeral_get $0 $e $i $_p9k__cwd || [[ $key != $_p9k_cache_val[1] ]] ; then
_p9k_prompt_length $delim _p9k_prompt_length $delim
@ -1837,11 +1836,7 @@ prompt_dir() {
parts[i]+=$'\2' parts[i]+=$'\2'
done done
fi fi
if [[ -n $key ]]; then _p9k_cache_ephemeral_set "$key" "${parts[@]}"
_p9k_cache_ephemeral_set "$key" "${parts[@]}"
else
_p9k_cache_val=("$key" "${parts[@]}")
fi
fi fi
parts=("${(@)_p9k_cache_val[2,-1]}") parts=("${(@)_p9k_cache_val[2,-1]}")
;; ;;