From e8e37eedbc8cf5e446be11971769df7cc10faeb0 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 12 Dec 2020 13:41:29 +0100 Subject: feat(updater): save version prior to updating so `omz changelog` just works™ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #9505 --- tools/changelog.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tools/changelog.sh') diff --git a/tools/changelog.sh b/tools/changelog.sh index 4ce42e5a3..845b1d4b4 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -340,16 +340,23 @@ function display-release { function main { # $1 = until commit, $2 = since commit - # $3 = output format (--raw|--text|--md) 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"}#--*} if [[ -z "$until" ]]; then until=HEAD fi - # If $since is not specified, look up first version tag before $until 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) || \ unset since elif [[ "$since" = --all ]]; then -- cgit v1.2.3-70-g09d2