From d33d632ec13dc2f2d6cdab1f79c35e6b2dc3bd1f Mon Sep 17 00:00:00 2001 From: Eric Nielsen <4120606+ericbn@users.noreply.github.com> Date: Fri, 15 Sep 2023 19:55:43 -0500 Subject: [PATCH] Use `--sort=-v:refname` in _zimfw_check_version to sort tags, instead of using Zsh's `(On)`. The tags will come sorted already. --- src/stage2/50_zimfw_check_version.zsh.erb | 8 +++----- src/zimfw.zsh.erb | 2 +- zimfw.zsh | 12 +++++------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/stage2/50_zimfw_check_version.zsh.erb b/src/stage2/50_zimfw_check_version.zsh.erb index ed3cf25..6ad4e1e 100644 --- a/src/stage2/50_zimfw_check_version.zsh.erb +++ b/src/stage2/50_zimfw_check_version.zsh.erb @@ -1,18 +1,16 @@ _zimfw_check_version() { if (( ${1} )); then - # Get latest version (get all `v*` tags from repo, delete `*v` from beginning, - # sort in descending `O`rder `n`umerically, and get the `[1]` first) if (( ${2} )); then # background check if [[ -w ${_zversion_target:h} ]]; then - print -R ${${(On)${(f)"$(GIT_HTTP_LOW_SPEED_LIMIT=1000 GIT_HTTP_LOW_SPEED_TIME=30 command git ls-remote --tags --refs \ + print -R ${${${(f)"$(GIT_HTTP_LOW_SPEED_LIMIT=1000 GIT_HTTP_LOW_SPEED_TIME=30 command git ls-remote --tags --refs --sort=-v:refname \ https://github.com/zimfw/zimfw.git 'v*' 2>/dev/null)"}##*v}[1]} >! ${_zversion_target} &! fi else # foreground check local tags - tags=$(command git ls-remote --tags --refs https://github.com/zimfw/zimfw.git 'v*') || return 1 - >! ${_zversion_target} <<<${${(On)${(f)tags}##*v}[1]} || return 1 + tags=$(command git ls-remote --tags --refs --sort=-v:refname https://github.com/zimfw/zimfw.git 'v*') || return 1 + >! ${_zversion_target} <<<${${${(f)tags}##*v}[1]} || return 1 fi fi if [[ -f ${_zversion_target} ]]; then diff --git a/src/zimfw.zsh.erb b/src/zimfw.zsh.erb index 069b0f4..89f2ed6 100644 --- a/src/zimfw.zsh.erb +++ b/src/zimfw.zsh.erb @@ -4,7 +4,7 @@ class Zim :clear_line, :ellipsis, :okay, :warn, :error, :done, :failed def initialize - @version = "1.12.0" + @version = "1.12.1-SNAPSHOT" @home = "${ZDOTDIR:-${HOME}}" @min_zsh_version = "5.2" # Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo diff --git a/zimfw.zsh b/zimfw.zsh index eb49f1a..166eefd 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -387,19 +387,17 @@ _zimfw_check_dumpfile() { _zimfw_check_version() { if (( ${1} )); then - # Get latest version (get all `v*` tags from repo, delete `*v` from beginning, - # sort in descending `O`rder `n`umerically, and get the `[1]` first) if (( ${2} )); then # background check if [[ -w ${_zversion_target:h} ]]; then - print -R ${${(On)${(f)"$(GIT_HTTP_LOW_SPEED_LIMIT=1000 GIT_HTTP_LOW_SPEED_TIME=30 command git ls-remote --tags --refs \ + print -R ${${${(f)"$(GIT_HTTP_LOW_SPEED_LIMIT=1000 GIT_HTTP_LOW_SPEED_TIME=30 command git ls-remote --tags --refs --sort=-v:refname \ https://github.com/zimfw/zimfw.git 'v*' 2>/dev/null)"}##*v}[1]} >! ${_zversion_target} &! fi else # foreground check local tags - tags=$(command git ls-remote --tags --refs https://github.com/zimfw/zimfw.git 'v*') || return 1 - >! ${_zversion_target} <<<${${(On)${(f)tags}##*v}[1]} || return 1 + tags=$(command git ls-remote --tags --refs --sort=-v:refname https://github.com/zimfw/zimfw.git 'v*') || return 1 + >! ${_zversion_target} <<<${${${(f)tags}##*v}[1]} || return 1 fi fi if [[ -f ${_zversion_target} ]]; then @@ -446,7 +444,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2023-07-17 23:54:58 UTC, previous commit is 49386ca)' + print -R 'zimfw version: '${_zversion}' (built at 2023-09-16 00:51:35 UTC, previous commit is e0d0679)' local zparam for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZIM_HOME ZSH_VERSION; do print -R ${(r.22....:.)zparam}${(P)zparam} @@ -847,7 +845,7 @@ _zimfw_run_tool_action() { zimfw() { builtin emulate -L zsh -o EXTENDED_GLOB - local -r _zversion='1.12.0' _zversion_target=${ZIM_HOME}/.latest_version zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] + local -r _zversion='1.12.1-SNAPSHOT' _zversion_target=${ZIM_HOME}/.latest_version zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] Actions: %Bbuild%b Build %B${ZIM_HOME}/init.zsh%b and %B${ZIM_HOME}/login_init.zsh%b.