diff options
Diffstat (limited to 'oh-my-zsh.sh')
-rw-r--r-- | oh-my-zsh.sh | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 435febc6d..5b057256d 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -4,14 +4,9 @@ if [[ -z "$ZSH_CACHE_DIR" ]]; then ZSH_CACHE_DIR="$ZSH/cache" fi -# Migrate .zsh-update file to $ZSH_CACHE_DIR -if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then - mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update -fi - # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then - env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh + source $ZSH/tools/check_for_upgrade.sh fi # Initializes Oh My Zsh @@ -62,13 +57,12 @@ if [ -z "$ZSH_COMPDUMP" ]; then fi # Construct zcompdump OMZ metadata -zcompdump_metadata="\ -#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null) -#omz fpath: $fpath\ -" +zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)" +zcompdump_fpath="#omz fpath: $fpath" # 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" zcompdump_refresh=1 fi @@ -86,10 +80,16 @@ fi # Append zcompdump metadata if missing if (( $zcompdump_refresh )); then - echo "\n$zcompdump_metadata" | tee -a "$ZSH_COMPDUMP" &>/dev/null + # Use `tee` in case the $ZSH_COMPDUMP filename is invalid, to silence the error + # See https://github.com/ohmyzsh/ohmyzsh/commit/dd1a7269#commitcomment-39003489 + tee -a "$ZSH_COMPDUMP" &>/dev/null <<EOF + +$zcompdump_revision +$zcompdump_fpath +EOF 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 |