1
0
Fork 0
mirror of synced 2024-11-26 09:15:34 -05:00

Fix getting default branch in update.zsh.erb

The regression was introduced in commit 3567694. I wrongly assumed that
`git fetch -pq origin HEAD` would fetch from the remote default branch.
Fixes #423
This commit is contained in:
Eric Nielsen 2021-02-17 15:55:38 -05:00
parent e53614e9f3
commit 36aa1b3fe9
No known key found for this signature in database
GPG key ID: 47D1DBFA0765A1FB
3 changed files with 13 additions and 5 deletions

View file

@ -3,7 +3,7 @@ readonly MODULE=${1}
readonly DIR=${2}
readonly URL=${3}
readonly TYPE=${4:=branch}
readonly REV=${5:=HEAD}
REV=${5}
readonly -i PRINTLEVEL=${6}
readonly CLEAR_LINE=$'\E[2K\r'
if (( PRINTLEVEL > 0 )) print -Rn ${CLEAR_LINE}"Updating ${MODULE}<%= ellipsis %>"
@ -19,6 +19,10 @@ if [[ ${URL} != $(command git config --get remote.origin.url) ]]; then
print -u2 -PR ${CLEAR_LINE}"%F{red}<%= error %>%B${MODULE}:%b URL does not match. Expected ${URL}. Will not try to update.%f"
return 1
fi
if [[ -z ${REV} ]]; then
# Get HEAD branch
REV=$(command git symbolic-ref --short HEAD)
fi
if [[ ${TYPE} == tag ]]; then
if [[ ${REV} == $(command git describe --tags --exact-match 2>/dev/null) ]]; then
if (( PRINTLEVEL > 0 )) print -PR ${CLEAR_LINE}"<%= okay %>%B${MODULE}:%b Already up to date"

View file

@ -6,7 +6,7 @@ class Zim
@home = "${ZDOTDIR:-${HOME}}"
@min_zsh_version = "5.2"
@startup_files_glob = ".z(shenv|profile|shrc|login|logout)"
@version = "1.4.0"
@version = "1.4.1-SNAPSHOT"
@ellipsis = " ..."
@okay = "%F{green})%f "
@warn = "! "

View file

@ -319,7 +319,7 @@ _zimfw_compile() {
}
_zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2021-01-07 18:39:43 UTC, previous commit is bcae8c0)'
print -R 'zimfw version: '${_zversion}' (built at 2021-02-17 20:54:27 UTC, previous commit is e53614e)'
print -R 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a)
@ -366,7 +366,7 @@ _zimfw_upgrade() {
}
zimfw() {
local -r _zversion='1.4.0'
local -r _zversion='1.4.1-SNAPSHOT'
local -r zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
Actions:
@ -436,7 +436,7 @@ readonly MODULE=\${1}
readonly DIR=\${2}
readonly URL=\${3}
readonly TYPE=\${4:=branch}
readonly REV=\${5:=HEAD}
REV=\${5}
readonly -i PRINTLEVEL=\${6}
readonly CLEAR_LINE=$'\E[2K\r'
if (( PRINTLEVEL > 0 )) print -Rn \${CLEAR_LINE}\"Updating \${MODULE} ...\"
@ -452,6 +452,10 @@ if [[ \${URL} != \$(command git config --get remote.origin.url) ]]; then
print -u2 -PR \${CLEAR_LINE}\"%F{red}x %B\${MODULE}:%b URL does not match. Expected \${URL}. Will not try to update.%f\"
return 1
fi
if [[ -z \${REV} ]]; then
# Get HEAD branch
REV=\$(command git symbolic-ref --short HEAD)
fi
if [[ \${TYPE} == tag ]]; then
if [[ \${REV} == \$(command git describe --tags --exact-match 2>/dev/null) ]]; then
if (( PRINTLEVEL > 0 )) print -PR \${CLEAR_LINE}\"%F{green})%f %B\${MODULE}:%b Already up to date\"