From 1f52eee1b1ef4a76b779d2017f2e7d2151516544 Mon Sep 17 00:00:00 2001 From: vladislav doster <10052309+vladdoster@users.noreply.github.com> Date: Mon, 20 Nov 2023 05:50:12 -0600 Subject: [PATCH] fix: from'gh-r' skips compile by default (#590) Skip compile when from'gh-r' ice is set unless compile is also set. Signed-off-by: Vladislav Doster --- doc/zsdoc/zinit-install.zsh.adoc | 2 +- tests/gh-r.zunit | 4 ++-- zinit-install.zsh | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/zsdoc/zinit-install.zsh.adoc b/doc/zsdoc/zinit-install.zsh.adoc index ce9ed9f73..c58c53528 100644 --- a/doc/zsdoc/zinit-install.zsh.adoc +++ b/doc/zsdoc/zinit-install.zsh.adoc @@ -94,7 +94,7 @@ ____ ____ -Has 83 line(s). Calls functions: +Has 87 line(s). Calls functions: .zinit-compile-plugin |-- zinit-side.zsh/.zinit-compute-ice diff --git a/tests/gh-r.zunit b/tests/gh-r.zunit index 0ace55692..9313fa1a0 100755 --- a/tests/gh-r.zunit +++ b/tests/gh-r.zunit @@ -5,7 +5,7 @@ HOME="$ZPFX" # Stops programs creating directories in user home export ZBIN="${ZPFX}/bin" export os_type="${OSTYPE//[0-9\.]*/}" - zinit default-ice --quiet from'gh-r' nocompile lbin'' + zinit default-ice --quiet from'gh-r' lbin } # @test 'atmos' { Universal Tool for DevOps and Cloud Automation (works with terraform, helm, helmfile, etc) @@ -723,7 +723,7 @@ run "$s" --version; assert $state equals 0 } @test 'sd' { # Intuitive find & replace CLI a.k.a modern sed - run zinit lbin'!sd* -> sd' for @chmln/sd; assert $state equals 0 + run zinit for @chmln/sd; assert $state equals 0 local sd="$ZBIN/sd"; assert "$sd" is_executable run "$sd" --version; assert $state equals 0 } diff --git a/zinit-install.zsh b/zinit-install.zsh index 62a6f85bc..8d3cf1e81 100644 --- a/zinit-install.zsh +++ b/zinit-install.zsh @@ -830,6 +830,12 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || { .zinit-compute-ice "$id_as" "pack" \ ICE plugin_dir filename is_snippet || return 1 + # when from"gh-r" ice set, skip compile unless compile ice is set + if [[ ${ICE[from]} = gh-r ]] && (( ${+ICE[compile]} == 0 )); then + +zi-log '{d} from"gh-r" detected, skipping compile' + return 0 + fi + if [[ ${ICE[pick]} != /dev/null && ${ICE[as]} != null && \ ${+ICE[null]} -eq 0 && ${ICE[as]} != command && ${+ICE[binary]} -eq 0 && \ ( ${+ICE[nocompile]} = 0 || ${ICE[nocompile]} = \! )