@@ -1833,62 +1833,52 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
18331833} # ]]]
18341834# FUNCTION: .zinit-self-update [[[
18351835# Updates Zinit code (does a git pull)
1836- .zinit-self-update () {
1836+ .zinit-self-update () {
18371837 builtin emulate -LR zsh ${=${options[xtrace]:# off} : +-o xtrace}
18381838 setopt extendedglob typesetsilent warncreateglobal
1839-
1840- if .zi-check-for-git-changes " $ZINIT [BIN_DIR]" ; then
1841- [[ $1 = -q ]] && +zi-log " {pre}[self-update]{info} updating zinit repository{msg2}" \
1842-
1843- local nl=$' \n ' escape=$' \x1b ['
1844- local current_branch=$( git -C $ZINIT [BIN_DIR] rev-parse --abbrev-ref HEAD)
1845- # local current_branch='main'
1846- local -a lines
1847- (
1848- builtin cd -q " $ZINIT [BIN_DIR]" \
1849- && +zi-log -n " {pre}[self-update]{info} fetching latest changes from {obj}$current_branch {info} branch$nl {rst}" \
1850- && command git fetch --quiet \
1851- && lines=( ${(f)" $( command git log --color --date=short --pretty=format:' %Cgreen%cd %h %Creset%s %Cred%d%Creset || %b' ..origin/HEAD) " } )
1852- if (( ${# lines} > 0 )) ; then
1853- # Remove the (origin/main ...) segments, to expect only tags to appear
1854- lines=( " ${(S)lines[@]// \( ([,[:blank:]]# (origin|HEAD|master|main)[^a-zA-Z]## (HEAD|origin|master|main)[,[:blank:]]# )# \) / } " )
1855- # Remove " ||" if it ends the line (i.e. no additional text from the body)
1856- lines=( " ${lines[@]/ \|\| [[:blank:]]# (# e)/ } " )
1857- # If there's no ref-name, 2 consecutive spaces occur - fix this
1858- lines=( " ${lines[@]/ (# b)[[:space:]]# \|\| [[:space:]]# (* )(# e)/ || ${match[1]} } " )
1859- lines=( " ${lines[@]/ (# b)$escape ([0-9]## )m[[:space:]]## ${escape} m/ $escape ${match[1]} m${escape} m} " )
1860- # Replace what follows "|| ..." with the same thing but with no
1861- # newlines, and also only first 10 words (the (w)-flag enables
1862- # word-indexing)
1863- lines=( " ${lines[@]/ (# b)[[:blank:]]# \|\| (* )(# e)/ | ${${match[1]// $nl / } [(w)1,(w)10]} } " )
1839+ (( ! OPTS[opt_- q,-- quiet] )) && +zi-log " {m} {b}Updating Zinit...{rst}"
1840+ local nl=$' \n ' escape=$' \x1b ['
1841+ local -a lines
1842+ (
1843+ builtin cd -q " $ZINIT [BIN_DIR]" && {
1844+ (( ! OPTS[opt_- q,-- quiet] )) && +zi-log -n " {m} {b}self-update{rst}: fetching latest changes from {obj}main{rst} branch{nl}{rst}"
1845+ } && command git fetch --all --quiet && lines=(${(f)" $( command git --no-pager log --color --date=short --pretty=' format:%C(yellow)%h%C(auto,magenta)% %C(auto,blue)%>(12,trunc)%ad %C(auto,reset)%s%C(auto,red)% gD% D %C(auto,green)%aN' -- ..origin/main) " } )
1846+ if (( ${# lines} > 0 )) ; then
1847+ lines=(" ${(S)lines[@]// \( ([,[:blank:]]# (origin|HEAD|master|main)[^a-zA-Z]## (HEAD|origin|master|main)[,[:blank:]]# )# \) / } " )
1848+ lines=(" ${lines[@]/ \|\| [[:blank:]]# (# e)/ } " )
1849+ lines=(" ${lines[@]/ (# b)[[:space:]]# \|\| [[:space:]]# (* )(# e)/ || ${match[1]} } " )
1850+ lines=(" ${lines[@]/ (# b)$escape ([0-9]## )m[[:space:]]## ${escape} m/ $escape ${match[1]} m${escape} m} " )
1851+ lines=(" ${lines[@]/ (# b)[[:blank:]]# \|\| (* )(# e)/ | ${${match[1]// $nl / } [(w)1,(w)10]} } " )
1852+ (( ! OPTS[opt_- q,-- quiet] )) && {
18641853 builtin print -rl -- " ${lines[@]} " | .zinit-pager
18651854 builtin print
1866- fi
1867- if [[ $1 != -q ]] {
1868- command git pull --no-stat --ff-only origin main
1869- } else {
1870- command git pull --no-stat --quiet --ff-only origin main
18711855 }
1872- )
1873- if [[ $1 != -q ]] {
1874- +zi-log " {pre}[self-update]{info} compiling zinit via {obj}zcompile{rst}"
1875- }
1876- command rm -f $ZINIT [BIN_DIR]/* .zwc(DN)
1877- zcompile -U $ZINIT [BIN_DIR]/zinit.zsh
1878- zcompile -U $ZINIT [BIN_DIR]/zinit-{' side' ,' install' ,' autoload' ,' additional' }.zsh
1879- zcompile -U $ZINIT [BIN_DIR]/share/git-process-output.zsh
1880- # Load for the current session
1881- [[ $1 != -q ]] && +zi-log " {pre}[self-update]{info} reloading zinit for the current session{rst}"
1882-
1883- # +zi-log "{pre}[self-update]{info} resetting zinit repository via{rst}: {cmd}${ICE[reset]:-git reset --hard HEAD}{rst}"
1884- source $ZINIT [BIN_DIR]/zinit.zsh
1885- zcompile -U $ZINIT [BIN_DIR]/zinit-{' side' ,' install' ,' autoload' }.zsh
1886- # Read and remember the new modification timestamps
1887- local file
1888- for file ( " " -side -install -autoload ) {
1889- .zinit-get-mtime-into " ${ZINIT[BIN_DIR]} /zinit$file .zsh" " ZINIT[mtime$file ]"
1890- }
1891- fi
1856+ fi
1857+ local branch=' origin main'
1858+ if (( ! OPTS[opt_- q,-- quiet] )) ; then
1859+ command git pull --autostash --ff-only --no-stat --squash ${=branch}
1860+ else
1861+ command git pull --autostash --ff-only --no-stat --quiet --squash ${=branch}
1862+ fi
1863+ # (( $? )) && {
1864+ # +zi-log "{w} Unable to update Zinit"
1865+ # return 0
1866+ # }
1867+ )
1868+ (( $? )) && {
1869+ +zi-log " {w} Unable to update Zinit"
1870+ return 0
1871+ }
1872+ command rm -f ${ZINIT[BIN_DIR]} /* .zwc(DN)
1873+ (( ! OPTS[opt_- q,-- quiet] )) && +zi-log " {m} {b}self-update{rst}: compiling zinit via {obj}zcompile{rst}"
1874+ local file
1875+ for file in ${ZINIT[BIN_DIR]} /zinit(* ).zsh(.N); do
1876+ builtin zcompile -Uz ${file: A}
1877+ .zinit-get-mtime-into " ${f: A} " " ZINIT[mtime${file: t} ]"
1878+ done
1879+ (( ! OPTS[opt_- q,-- quiet] )) && +zi-log " {m} {b}self-update{rst}: reloading zinit for the current session{rst}"
1880+ builtin source ${ZINIT[BIN_DIR]} /zinit.zsh
1881+ +zi-log " {i} {b}Updated Zinit{rst}"
18921882} # ]]]
18931883
18941884# FUNCTION: .zinit-show-all-reports [[[
0 commit comments