summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/cli.zsh7
-rw-r--r--tools/check_for_upgrade.sh3
-rwxr-xr-xtools/upgrade.sh1
3 files changed, 5 insertions, 6 deletions
diff --git a/lib/cli.zsh b/lib/cli.zsh
index 3346d3973..38e2f72f8 100644
--- a/lib/cli.zsh
+++ b/lib/cli.zsh
@@ -401,13 +401,14 @@ function _omz::theme::use {
}
function _omz::update {
+ local last_commit=$(cd "$ZSH"; git rev-parse HEAD)
+
# Run update script
if [[ "$1" != --unattended ]]; then
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
else
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
fi
- local ret=$?
# Update last updated file
zmodload zsh/datetime
@@ -415,8 +416,8 @@ function _omz::update {
# Remove update lock if it exists
command rm -rf "$ZSH/log/update.lock"
- # Restart the zsh session
- if [[ $ret -eq 0 && "$1" != --unattended ]]; then
+ # Restart the zsh session if there were changes
+ if [[ "$1" != --unattended && "$(cd "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
# Old zsh versions don't have ZSH_ARGZERO
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
# Check whether to run a login shell
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index 88e521eea..29a48b880 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -24,8 +24,7 @@ function update_last_updated_file() {
}
function update_ohmyzsh() {
- ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
- if [[ "$?" = (0|80) ]]; then
+ if ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive; then
update_last_updated_file
fi
}
diff --git a/tools/upgrade.sh b/tools/upgrade.sh
index 4b97540d6..417e06fe8 100755
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -66,7 +66,6 @@ if git pull --rebase --stat origin master; then
# Check if it was really updated or not
if [[ "$(git rev-parse HEAD)" = "$last_commit" ]]; then
message="Oh My Zsh is already at the latest version."
- ret=80 # non-zero exit code to indicate no changes pulled
else
message="Hooray! Oh My Zsh has been updated!"