1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2025-12-12 15:34:50 +08:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Marc Cornellà
c58572d5fe init: oops 2020-06-02 12:06:40 +02:00
Marc Cornellà
0e12ebb42d init: use grep for zcompdump metadata check
Closes #8981
2020-06-02 11:45:50 +02:00

View File

@ -62,13 +62,12 @@ if [ -z "$ZSH_COMPDUMP" ]; then
fi fi
# Construct zcompdump OMZ metadata # Construct zcompdump OMZ metadata
zcompdump_metadata="\ zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null) zcompdump_fpath="#omz fpath: $fpath"
#omz fpath: $fpath\
"
# Delete the zcompdump file if OMZ zcompdump metadata changed # Delete the zcompdump file if OMZ zcompdump metadata changed
if ! cmp -s <(command grep '^#omz' "$ZSH_COMPDUMP" 2>/dev/null) <(echo "$zcompdump_metadata"); then if ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null \
|| ! command grep -q -Fx "$zcompdump_fpath" "$ZSH_COMPDUMP" 2>/dev/null; then
command rm -f "$ZSH_COMPDUMP" command rm -f "$ZSH_COMPDUMP"
zcompdump_refresh=1 zcompdump_refresh=1
fi fi
@ -86,10 +85,14 @@ fi
# Append zcompdump metadata if missing # Append zcompdump metadata if missing
if (( $zcompdump_refresh )); then if (( $zcompdump_refresh )); then
echo "\n$zcompdump_metadata" | tee -a "$ZSH_COMPDUMP" &>/dev/null cat >>| "$ZSH_COMPDUMP" <<EOF
$zcompdump_revision
$zcompdump_fpath
EOF
fi fi
unset zcompdump_metadata zcompdump_refresh unset zcompdump_revision zcompdump_fpath zcompdump_refresh
# Load all of the config files in ~/oh-my-zsh that end in .zsh # Load all of the config files in ~/oh-my-zsh that end in .zsh