mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 07:36:38 -04:00
*install,*autoload: A flag ZINIT[annex-multi-flag:pull-active] that
informs annexes if any new commits are (to be) downloaded
This commit is contained in:
parent
c4f340fec7
commit
7d30af80ac
|
|
@ -1406,6 +1406,10 @@ ZINIT[EXTENDED_GLOB]=""
|
|||
return 0
|
||||
fi
|
||||
|
||||
# A flag for the annexes. 0 – no new commits, 1 - run-atpull mode,
|
||||
# 2 – full update/there are new commits to download.
|
||||
ZINIT[annex-multi-flag:pull-active]=0
|
||||
|
||||
(( ${#ZINIT_ICE[@]} > 0 )) && { ZINIT_SICE[$user/$plugin]=""; local nf="-nftid"; }
|
||||
|
||||
.zinit-compute-ice "$user${${user:#(%|/)*}:+/}$plugin" "pack$nf" \
|
||||
|
|
@ -1455,6 +1459,7 @@ ZINIT[EXTENDED_GLOB]=""
|
|||
} else {
|
||||
do_update=1
|
||||
}
|
||||
ZINIT[annex-multi-flag:pull-active]=$(( 0 + 2*do_update - (skip_pull && do_update) ))
|
||||
|
||||
if (( do_update )) {
|
||||
(( !skip_pull )) && [[ "${ICE_OPTS[opt_-r,--reset]}" = 1 ]] && {
|
||||
|
|
@ -1528,6 +1533,8 @@ ZINIT[EXTENDED_GLOB]=""
|
|||
}
|
||||
}
|
||||
|
||||
ZINIT[annex-multi-flag:pull-active]=$(( 0 + 2*do_update - (skip_pull && do_update) ))
|
||||
|
||||
if (( do_update )) {
|
||||
(( !skip_pull )) && [[ "${ICE_OPTS[opt_-r,--reset]}" = 1 ]] && {
|
||||
print -P "${ZINIT[col-msg2]}Resetting the repository (-r/--reset given)...%f"
|
||||
|
|
@ -1553,7 +1560,9 @@ ZINIT[EXTENDED_GLOB]=""
|
|||
print
|
||||
}
|
||||
}
|
||||
return ${ZINIT[annex-multi-flag:pull-active]}
|
||||
)
|
||||
ZINIT[annex-multi-flag:pull-active]=$?
|
||||
}
|
||||
|
||||
[[ -d "$local_dir/.git" ]] && \
|
||||
|
|
|
|||
|
|
@ -875,6 +875,11 @@ builtin source ${ZINIT[BIN_DIR]}"/zinit-side.zsh"
|
|||
|
||||
[[ "$update" = "-u" && "${ICE_OPTS[opt_-q,--quiet]}" != 1 ]] && print -r -- $'\n'"${ZINIT[col-info]}Updating snippet ${ZINIT[col-p]}$sname${ZINIT[col-rst]}${ZINIT_ICE[id-as]:+... (identified as $id_as)}"
|
||||
|
||||
# A flag for the annexes telling whether there have been any
|
||||
# new commits / updated files to download. 0 – no new commits,
|
||||
# 1 – run-atpull mode, 2 – full update/there are new commits.
|
||||
ZINIT[annex-multi-flag:pull-active]=0
|
||||
|
||||
(
|
||||
if [[ "$url" = (http|https|ftp|ftps|scp)://* ]] {
|
||||
# URL
|
||||
|
|
@ -890,8 +895,10 @@ builtin source ${ZINIT[BIN_DIR]}"/zinit-side.zsh"
|
|||
.zinit-mirror-using-svn "$url" "-t" "$dirname" || {
|
||||
(( ${+ZINIT_ICE[run-atpull]} )) && {
|
||||
skip_pull=1
|
||||
} || return 2
|
||||
} || return 2 # Will return when no updates thus the
|
||||
# atpull'' code doesn't need any checks
|
||||
}
|
||||
ZINIT[annex-multi-flag:pull-active]=$(( 2 - skip_pull ))
|
||||
|
||||
(( !skip_pull )) && [[ "${ICE_OPTS[opt_-r,--reset]}" = 1 && -d "$filename/.svn" ]] && {
|
||||
print -P "${ZINIT[col-msg2]}Resetting the repository (-r/--reset given)...%f"
|
||||
|
|
@ -950,6 +957,8 @@ builtin source ${ZINIT[BIN_DIR]}"/zinit-side.zsh"
|
|||
}
|
||||
}
|
||||
fi
|
||||
|
||||
return $(( skip_pull ? 3 : 0 ))
|
||||
} else {
|
||||
command mkdir -p "$local_dir/$dirname"
|
||||
|
||||
|
|
@ -973,6 +982,8 @@ builtin source ${ZINIT[BIN_DIR]}"/zinit-side.zsh"
|
|||
(( ${+ZINIT_ICE[run-atpull]} )) && skip_dl=1 || return 2
|
||||
}
|
||||
|
||||
ZINIT[annex-multi-flag:pull-active]=$(( (2 - skip_dl) * ( secs > 1 ) ))
|
||||
|
||||
if (( !skip_dl )) {
|
||||
[[ "${ICE_OPTS[opt_-r,--reset]}" = 1 ]] && {
|
||||
[[ ${ICE_OPTS[opt_-q,--quiet]} != 1 && -f $dirname/$filename ]] && print -P "${ZINIT[col-msg2]}Removing the file (-r/--reset given)...%f"
|
||||
|
|
@ -1000,10 +1011,17 @@ builtin source ${ZINIT[BIN_DIR]}"/zinit-side.zsh"
|
|||
}
|
||||
}
|
||||
}
|
||||
# Return 4 if the file's status couldn't be checked
|
||||
# - to indicate that the hooks should be run, however
|
||||
# the flag should be set to 0
|
||||
return $(( skip_dl ? 3 : (secs <= 1) * 4 ))
|
||||
}
|
||||
return 0
|
||||
) || retval=$?
|
||||
|
||||
# Overestimate the pull-level to 2 also in error situations
|
||||
# – no hooks will be run anyway because of the error
|
||||
ZINIT[annex-multi-flag:pull-active]=$(( retval == 3 ? 1 : ((retval == 2 || retval == 4) ? 0 : 2) ))
|
||||
|
||||
if [[ -n "${ZINIT_ICE[compile]}" ]]; then
|
||||
list=( ${(M)~ZINIT_ICE[compile]##/*}(DN) $local_dir/$dirname/${~ZINIT_ICE[compile]}(DN) )
|
||||
[[ ${#list} -eq 0 ]] && {
|
||||
|
|
|
|||
Loading…
Reference in a new issue