Fix getting HEAD remote branch in update.zsh.erb
instead of getting just the current local branch.
This commit is contained in:
parent
36aa1b3fe9
commit
12dab4e893
3 changed files with 29 additions and 22 deletions
|
@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
_No unreleased changes._
|
### Fixed
|
||||||
|
- Correctly get the repository's default branch. The related change in version
|
||||||
|
1.4.0 actually broke updating the modules, as new changes stopped being
|
||||||
|
fetched.
|
||||||
|
|
||||||
## [1.4.0] - 2021-01-07
|
## [1.4.0] - 2021-01-07
|
||||||
|
|
||||||
|
|
|
@ -19,15 +19,18 @@ 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"
|
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
|
return 1
|
||||||
fi
|
fi
|
||||||
if [[ -z ${REV} ]]; then
|
|
||||||
# Get HEAD branch
|
|
||||||
REV=$(command git symbolic-ref --short HEAD)
|
|
||||||
fi
|
|
||||||
if [[ ${TYPE} == tag ]]; then
|
if [[ ${TYPE} == tag ]]; then
|
||||||
if [[ ${REV} == $(command git describe --tags --exact-match 2>/dev/null) ]]; 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"
|
if (( PRINTLEVEL > 0 )) print -PR ${CLEAR_LINE}"<%= okay %>%B${MODULE}:%b Already up to date"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
elif [[ -z ${REV} ]]; then
|
||||||
|
# Get HEAD remote branch
|
||||||
|
if ! ERR=$(command git remote set-head origin -a 2>&1); then
|
||||||
|
print -u2 -PR ${CLEAR_LINE}"%F{red}<%= error %>%B${MODULE}:%b Error during git remote set-head%f"$'\n'${(F):- ${(f)^ERR}}
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
REV=${$(command git symbolic-ref --short refs/remotes/origin/HEAD)#origin/} || return 1
|
||||||
fi
|
fi
|
||||||
if ! ERR=$(command git fetch -pq origin ${REV} 2>&1); then
|
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}}
|
print -u2 -PR ${CLEAR_LINE}"%F{red}<%= error %>%B${MODULE}:%b Error during git fetch%f"$'\n'${(F):- ${(f)^ERR}}
|
||||||
|
@ -53,12 +56,11 @@ if [[ ${TYPE} == branch ]]; then
|
||||||
else
|
else
|
||||||
OUT="Updating to ${TYPE} ${REV}"
|
OUT="Updating to ${TYPE} ${REV}"
|
||||||
fi
|
fi
|
||||||
if ERR=$(command git submodule update --init --recursive -q 2>&1); then
|
if ! ERR=$(command git submodule update --init --recursive -q 2>&1); then
|
||||||
|
print -u2 -PR ${CLEAR_LINE}"%F{red}<%= error %>%B${MODULE}:%b Error during git submodule update%f"$'\n'${(F):- ${(f)^ERR}}
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
if (( PRINTLEVEL > 0 )); then
|
if (( PRINTLEVEL > 0 )); then
|
||||||
if [[ -n ${LOG} ]] OUT=${OUT}$'\n'${(F):- ${(f)^LOG}}
|
if [[ -n ${LOG} ]] OUT=${OUT}$'\n'${(F):- ${(f)^LOG}}
|
||||||
print -PR ${CLEAR_LINE}"<%= okay %>%B${MODULE}:%b ${OUT}"
|
print -PR ${CLEAR_LINE}"<%= okay %>%B${MODULE}:%b ${OUT}"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
print -u2 -PR ${CLEAR_LINE}"%F{red}<%= error %>%B${MODULE}:%b Error during git submodule update%f"$'\n'${(F):- ${(f)^ERR}}
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
22
zimfw.zsh
22
zimfw.zsh
|
@ -319,7 +319,7 @@ _zimfw_compile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_zimfw_info() {
|
_zimfw_info() {
|
||||||
print -R 'zimfw version: '${_zversion}' (built at 2021-02-17 20:54:27 UTC, previous commit is e53614e)'
|
print -R 'zimfw version: '${_zversion}' (built at 2021-02-17 22:48:17 UTC, previous commit is 36aa1b3)'
|
||||||
print -R 'ZIM_HOME: '${ZIM_HOME}
|
print -R 'ZIM_HOME: '${ZIM_HOME}
|
||||||
print -R 'Zsh version: '${ZSH_VERSION}
|
print -R 'Zsh version: '${ZSH_VERSION}
|
||||||
print -R 'System info: '$(command uname -a)
|
print -R 'System info: '$(command uname -a)
|
||||||
|
@ -452,15 +452,18 @@ 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\"
|
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
|
return 1
|
||||||
fi
|
fi
|
||||||
if [[ -z \${REV} ]]; then
|
|
||||||
# Get HEAD branch
|
|
||||||
REV=\$(command git symbolic-ref --short HEAD)
|
|
||||||
fi
|
|
||||||
if [[ \${TYPE} == tag ]]; then
|
if [[ \${TYPE} == tag ]]; then
|
||||||
if [[ \${REV} == \$(command git describe --tags --exact-match 2>/dev/null) ]]; 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\"
|
if (( PRINTLEVEL > 0 )) print -PR \${CLEAR_LINE}\"%F{green})%f %B\${MODULE}:%b Already up to date\"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
elif [[ -z \${REV} ]]; then
|
||||||
|
# Get HEAD remote branch
|
||||||
|
if ! ERR=\$(command git remote set-head origin -a 2>&1); then
|
||||||
|
print -u2 -PR \${CLEAR_LINE}\"%F{red}x %B\${MODULE}:%b Error during git remote set-head%f\"$'\n'\${(F):- \${(f)^ERR}}
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
REV=\${\$(command git symbolic-ref --short refs/remotes/origin/HEAD)#origin/} || return 1
|
||||||
fi
|
fi
|
||||||
if ! ERR=\$(command git fetch -pq origin \${REV} 2>&1); then
|
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}}
|
print -u2 -PR \${CLEAR_LINE}\"%F{red}x %B\${MODULE}:%b Error during git fetch%f\"$'\n'\${(F):- \${(f)^ERR}}
|
||||||
|
@ -486,15 +489,14 @@ if [[ \${TYPE} == branch ]]; then
|
||||||
else
|
else
|
||||||
OUT=\"Updating to \${TYPE} \${REV}\"
|
OUT=\"Updating to \${TYPE} \${REV}\"
|
||||||
fi
|
fi
|
||||||
if ERR=\$(command git submodule update --init --recursive -q 2>&1); then
|
if ! ERR=\$(command git submodule update --init --recursive -q 2>&1); then
|
||||||
|
print -u2 -PR \${CLEAR_LINE}\"%F{red}x %B\${MODULE}:%b Error during git submodule update%f\"$'\n'\${(F):- \${(f)^ERR}}
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
if (( PRINTLEVEL > 0 )); then
|
if (( PRINTLEVEL > 0 )); then
|
||||||
if [[ -n \${LOG} ]] OUT=\${OUT}$'\n'\${(F):- \${(f)^LOG}}
|
if [[ -n \${LOG} ]] OUT=\${OUT}$'\n'\${(F):- \${(f)^LOG}}
|
||||||
print -PR \${CLEAR_LINE}\"%F{green})%f %B\${MODULE}:%b \${OUT}\"
|
print -PR \${CLEAR_LINE}\"%F{green})%f %B\${MODULE}:%b \${OUT}\"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
print -u2 -PR \${CLEAR_LINE}\"%F{red}x %B\${MODULE}:%b Error during git submodule update%f\"$'\n'\${(F):- \${(f)^ERR}}
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
"
|
"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue