Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: alist repository for gh-r test (#305) #1

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refactor: self-update logic & log styling (zdharma-continuum#307)
* refactor: self-update logging
* use git branch logic compatible with older git versions (e.g., v1.8.x)
* maint: consistent logging colors
* fix: add a new line in`update` command logging
* docs: re-generate zinit-autoload.zsh asciidoc

Signed-off-by: Vladislav Doster <[email protected]>
  • Loading branch information
vladdoster authored Jun 11, 2022
commit 4546669f778e4e27e2f4d8f6ed47da9a590e579f
2 changes: 1 addition & 1 deletion doc/zsdoc/zinit-autoload.zsh.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ ____
User-action entry point.
____

Has 44 line(s). Calls functions:
Has 42 line(s). Calls functions:

.zinit-self-update
|-- zinit.zsh/+zinit-message
Expand Down
15 changes: 8 additions & 7 deletions zinit-autoload.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -711,16 +711,17 @@ ZINIT[EXTENDED_GLOB]=""
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
setopt extendedglob typesetsilent warncreateglobal

[[ $1 = -q ]] && +zinit-message -n "{pre}[self-update]{msg2} Updating Zinit repository{msg2}" \
[[ $1 = -q ]] && +zinit-message "{pre}[self-update]{info} updating zinit repository{msg2}" \

local nl=$'\n' escape=$'\x1b['
local current_branch=$(builtin pushd $ZINIT[BIN_DIR] > /dev/null && git branch --show-current && popd > /dev/null)
local current_branch=$(git -C $ZINIT[BIN_DIR] rev-parse --abbrev-ref HEAD)
# local current_branch='main'
local -a lines
(
builtin cd -q "$ZINIT[BIN_DIR]" \
&& +zinit-message -n "{pre}[self-update]{info} fetching latest changes from {cmd}$current_branch$nl{rst}" \
&& +zinit-message -n "{pre}[self-update]{info} fetching latest changes from {obj}$current_branch{info} branch$nl{rst}" \
&& command git fetch --quiet \
&& lines=( ${(f)"$(command git log --color --date=short --pretty=format:'%Cgreen%cd %h %Creset%s %Cred%d%Creset || %b' ..FETCH_HEAD)"} )
&& lines=( ${(f)"$(command git log --color --date=short --pretty=format:'%Cgreen%cd %h %Creset%s %Cred%d%Creset || %b' ..origin/HEAD)"} )
if (( ${#lines} > 0 )); then
# Remove the (origin/main ...) segments, to expect only tags to appear
lines=( "${(S)lines[@]//\(([,[:blank:]]#(origin|HEAD|master|main)[^a-zA-Z]##(HEAD|origin|master|main)[,[:blank:]]#)#\)/}" )
Expand All @@ -743,16 +744,16 @@ ZINIT[EXTENDED_GLOB]=""
}
)
if [[ $1 != -q ]] {
+zinit-message "{pre}[self-update]{info} compiling zinit via {cmd}zcompile{rst}"
+zinit-message "{pre}[self-update]{info} compiling zinit via {obj}zcompile{rst}"
}
command rm -f $ZINIT[BIN_DIR]/*.zwc(DN)
zcompile -U $ZINIT[BIN_DIR]/zinit.zsh
zcompile -U $ZINIT[BIN_DIR]/zinit-{'side','install','autoload','additional'}.zsh
zcompile -U $ZINIT[BIN_DIR]/share/git-process-output.zsh
# Load for the current session
[[ $1 != -q ]] && +zinit-message "{pre}[self-update]{info} Reloading Zinit for the current session{rst}"
[[ $1 != -q ]] && +zinit-message "{pre}[self-update]{info} reloading zinit for the current session{rst}"

+zinit-message "{pre}self-update: {msg2}Resetting the repository with command:{rst} ${ICE[reset]:-git reset --hard HEAD} {…}"
# +zinit-message "{pre}[self-update]{info} resetting zinit repository via{rst}: {cmd}${ICE[reset]:-git reset --hard HEAD}{rst}"
source $ZINIT[BIN_DIR]/zinit.zsh
zcompile -U $ZINIT[BIN_DIR]/zinit-{'side','install','autoload'}.zsh
# Read and remember the new modification timestamps
Expand Down