diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 3e547d358..7d820bbfa 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -110,9 +110,14 @@ if [[ -z "$ZSH_COMPDUMP" ]]; then ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" fi -# Construct zcompdump OMZ metadata +# Construct zcompdump OMZ metadata. fpath is deduplicated (preserving +# first-occurrence order) before comparison so that sessions which +# differ only in duplicate counts produce identical metadata. Order is +# preserved because `compinit` resolves colliding completion files by +# first-occurrence in fpath, so two fpaths with the same entries in a +# different order can legitimately produce different completions. zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)" -zcompdump_fpath="#omz fpath: $fpath" +zcompdump_fpath="#omz fpath: ${${(@u)fpath}}" # Delete the zcompdump file if OMZ zcompdump metadata changed if ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null \