summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2021-03-03 13:08:41 -0700
committerTuowen Zhao <ztuowen@gmail.com>2021-03-03 13:08:41 -0700
commit0f2bface6494ae546ea83cbf45b65a18dbc0c4fb (patch)
tree5a33e6db95c55b4ad75a064b9c3e40d8f09f6b7b /lib
parentc6e754a3119b7273a57f0cfed38e85303662d26b (diff)
parent6fbad5bf72fad4ecf30ba4d4ffee62bac582f0ed (diff)
downloadzsh-0f2bface6494ae546ea83cbf45b65a18dbc0c4fb.tar.gz
zsh-0f2bface6494ae546ea83cbf45b65a18dbc0c4fb.tar.bz2
zsh-0f2bface6494ae546ea83cbf45b65a18dbc0c4fb.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'lib')
-rw-r--r--lib/cli.zsh7
1 files changed, 4 insertions, 3 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