perf(init): skip the compdump lock and zrecompile when the .zwc is fresh (#14064)

This commit is contained in:
Robby Russell
2026-09-07 10:14:56 +02:00
committed by GitHub
parent 992edcc17d
commit 0da7919339
+3 -1
View File
@@ -148,7 +148,9 @@ fi
unset zcompdump_revision zcompdump_fpath zcompdump_refresh
# zcompile the completion dump file if the .zwc is older or missing.
if command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then
# Test that first so the lock directory and zrecompile are skipped when it's fresh.
if [[ ! "${ZSH_COMPDUMP}.zwc" -nt "$ZSH_COMPDUMP" ]] \
&& command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then
zrecompile -q -p "$ZSH_COMPDUMP"
command rm -rf "$ZSH_COMPDUMP.zwc.old" "${ZSH_COMPDUMP}.lock"
fi