diff --git a/CHANGELOG.md b/CHANGELOG.md index 50c4a71..4231e1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -_No unreleased changes._ +### Fixed +- "Not a valid ref: refs/remotes/origin/main" error when the repository's default + branch was renamed to main. ## [1.4.1] - 2021-02-17 diff --git a/src/tools/update.zsh.erb b/src/tools/update.zsh.erb index f8c9b1a..f6394f1 100644 --- a/src/tools/update.zsh.erb +++ b/src/tools/update.zsh.erb @@ -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 ! ERR=$(command git fetch -pq origin 2>&1); then + print -u2 -PR ${CLEAR_LINE}"%F{red}<%= error %>%B${MODULE}:%b Error during git fetch%f"$'\n'${(F):- ${(f)^ERR}} + return 1 +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" @@ -32,10 +36,6 @@ elif [[ -z ${REV} ]]; then fi REV=${$(command git symbolic-ref --short refs/remotes/origin/HEAD)#origin/} || return 1 fi -if ! ERR=$(command git fetch -pq origin ${REV} 2>&1); then - print -u2 -PR ${CLEAR_LINE}"%F{red}<%= error %>%B${MODULE}:%b Error during git fetch%f"$'\n'${(F):- ${(f)^ERR}} - return 1 -fi if [[ ${TYPE} == branch ]]; then LOG_REV=${REV}@{u} else diff --git a/src/zimfw.zsh.erb b/src/zimfw.zsh.erb index d5a191b..5947e98 100644 --- a/src/zimfw.zsh.erb +++ b/src/zimfw.zsh.erb @@ -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.1" + @version = "1.4.2-SNAPSHOT" @ellipsis = " ..." @okay = "%F{green})%f " @warn = "! " diff --git a/zimfw.zsh b/zimfw.zsh index d80e954..221b90b 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -319,7 +319,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2021-02-17 23:25:22 UTC, previous commit is 12dab4e)' + print -R 'zimfw version: '${_zversion}' (built at 2021-02-19 19:42:09 UTC, previous commit is ddfba96)' 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.1' + local -r _zversion='1.4.2-SNAPSHOT' local -r zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] Actions: @@ -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 ! ERR=\$(command git fetch -pq origin 2>&1); then + print -u2 -PR \${CLEAR_LINE}\"%F{red}x %B\${MODULE}:%b Error during git fetch%f\"$'\n'\${(F):- \${(f)^ERR}} + return 1 +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\" @@ -465,10 +469,6 @@ elif [[ -z \${REV} ]]; then fi REV=\${\$(command git symbolic-ref --short refs/remotes/origin/HEAD)#origin/} || return 1 fi -if ! ERR=\$(command git fetch -pq origin \${REV} 2>&1); then - print -u2 -PR \${CLEAR_LINE}\"%F{red}x %B\${MODULE}:%b Error during git fetch%f\"$'\n'\${(F):- \${(f)^ERR}} - return 1 -fi if [[ \${TYPE} == branch ]]; then LOG_REV=\${REV}@{u} else