forked from extern/ohmyzsh
feat(updater): save version prior to updating so omz changelog
just works™
Fixes #9505
This commit is contained in:
parent
9d6b3984f9
commit
e8e37eedbc
@ -340,16 +340,23 @@ function display-release {
|
|||||||
|
|
||||||
function main {
|
function main {
|
||||||
# $1 = until commit, $2 = since commit
|
# $1 = until commit, $2 = since commit
|
||||||
# $3 = output format (--raw|--text|--md)
|
|
||||||
local until="$1" since="$2"
|
local until="$1" since="$2"
|
||||||
|
|
||||||
|
# $3 = output format (--text|--raw|--md)
|
||||||
|
# --md: uses markdown formatting
|
||||||
|
# --raw: outputs without style
|
||||||
|
# --text: uses ANSI escape codes to style the output
|
||||||
local output=${${3:-"--text"}#--*}
|
local output=${${3:-"--text"}#--*}
|
||||||
|
|
||||||
if [[ -z "$until" ]]; then
|
if [[ -z "$until" ]]; then
|
||||||
until=HEAD
|
until=HEAD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If $since is not specified, look up first version tag before $until
|
|
||||||
if [[ -z "$since" ]]; then
|
if [[ -z "$since" ]]; then
|
||||||
|
# If $since is not specified:
|
||||||
|
# 1) try to find the version used before updating
|
||||||
|
# 2) try to find the first version tag before $until
|
||||||
|
since=$(command git config --get oh-my-zsh.lastVersion 2>/dev/null) || \
|
||||||
since=$(command git describe --abbrev=0 --tags "$until^" 2>/dev/null) || \
|
since=$(command git describe --abbrev=0 --tags "$until^" 2>/dev/null) || \
|
||||||
unset since
|
unset since
|
||||||
elif [[ "$since" = --all ]]; then
|
elif [[ "$since" = --all ]]; then
|
||||||
|
@ -10,7 +10,7 @@ cd "$ZSH"
|
|||||||
# and that terminal supports them.
|
# and that terminal supports them.
|
||||||
|
|
||||||
local -a RAINBOW
|
local -a RAINBOW
|
||||||
local RED GREEN YELLOW BLUE UNDER BOLD RESET
|
local RED GREEN YELLOW BLUE BOLD DIM UNDER RESET
|
||||||
|
|
||||||
if [ -t 1 ]; then
|
if [ -t 1 ]; then
|
||||||
RAINBOW=(
|
RAINBOW=(
|
||||||
@ -28,6 +28,7 @@ if [ -t 1 ]; then
|
|||||||
YELLOW=$(printf '\033[33m')
|
YELLOW=$(printf '\033[33m')
|
||||||
BLUE=$(printf '\033[34m')
|
BLUE=$(printf '\033[34m')
|
||||||
BOLD=$(printf '\033[1m')
|
BOLD=$(printf '\033[1m')
|
||||||
|
DIM=$(printf '\033[2m')
|
||||||
UNDER=$(printf '\033[4m')
|
UNDER=$(printf '\033[4m')
|
||||||
RESET=$(printf '\033[m')
|
RESET=$(printf '\033[m')
|
||||||
fi
|
fi
|
||||||
@ -69,6 +70,9 @@ if git pull --rebase --stat origin master; then
|
|||||||
else
|
else
|
||||||
message="Hooray! Oh My Zsh has been updated!"
|
message="Hooray! Oh My Zsh has been updated!"
|
||||||
|
|
||||||
|
# Save the commit prior to updating
|
||||||
|
git config oh-my-zsh.lastVersion "$last_commit"
|
||||||
|
|
||||||
# Display changelog with less if available, otherwise just print it to the terminal
|
# Display changelog with less if available, otherwise just print it to the terminal
|
||||||
if [[ "$1" = --interactive ]]; then
|
if [[ "$1" = --interactive ]]; then
|
||||||
if (( $+commands[less] )); then
|
if (( $+commands[less] )); then
|
||||||
@ -77,6 +81,8 @@ if git pull --rebase --stat origin master; then
|
|||||||
"$ZSH/tools/changelog.sh" HEAD "$last_commit"
|
"$ZSH/tools/changelog.sh" HEAD "$last_commit"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf "${BLUE}%s \`${BOLD}%s${RESET}${BLUE}\`${RESET}\n" "You can see the changelog again with" "omz changelog"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET
|
printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET
|
||||||
|
Loading…
Reference in New Issue
Block a user