From da0d6b712c6466d11165ac9e27a6cd7de856e537 Mon Sep 17 00:00:00 2001 From: Miles Liu Date: Sat, 7 Jan 2023 11:15:54 +0800 Subject: [PATCH] fix: broken symbolic link after `creinstall .` Signed-off-by: Miles Liu --- tests/plugins.zunit | 6 ++++++ zinit-install.zsh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/plugins.zunit b/tests/plugins.zunit index e30bda8c..251bb23a 100755 --- a/tests/plugins.zunit +++ b/tests/plugins.zunit @@ -37,6 +37,12 @@ local vim="$ZBIN/vim"; assert $vim is_executable $vim --version; assert $state equals 0 } +@test 'zsh-completions' { + run zinit light-mode for zsh-users/zsh-completions + zinit cd zsh-users/zsh-completions + run zinit creinstall -q .; assert $state equals 0 + local broken_completions=($(echo "$ZINIT[COMPLETIONS_DIR]"/*(-@))); assert "${#broken_completions[@]}" equals 0 +} # @test 'zsh_bin' { # run zinit as'null' sbin'bin/zsh' for @romkatv/zsh-bin # assert $state equals 0 diff --git a/zinit-install.zsh b/zinit-install.zsh index c839483f..d9b9bb23 100644 --- a/zinit-install.zsh +++ b/zinit-install.zsh @@ -563,7 +563,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || { # Symlink completions if they are not already there # either as completions (_fname) or as backups (fname) # OR - if its a reinstall - for c in "${completions[@]}"; do + for c in "${completions[@]:A}"; do cfile="${c:t}" bkpfile="${cfile#_}" if [[ ( -z ${already_symlinked[(r)*/$cfile]} || $reinstall = 1 ) &&