Skip to content

Commit

Permalink
fix: from'gh-r' skips compile by default (#590)
Browse files Browse the repository at this point in the history
Skip compile when from'gh-r' ice is set unless compile is also set.

Signed-off-by: Vladislav Doster <[email protected]>
  • Loading branch information
vladdoster authored Nov 20, 2023
1 parent 8170753 commit 1f52eee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/zsdoc/zinit-install.zsh.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/gh-r.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down
6 changes: 6 additions & 0 deletions zinit-install.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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]} = \! )
Expand Down

0 comments on commit 1f52eee

Please sign in to comment.