mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-06-15 09:08:27 +00:00
Compare commits
1 Commits
master
...
rr-13813-i
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84429a7229 |
@@ -466,6 +466,15 @@ zstyle ':omz:update' frequency 7
|
|||||||
zstyle ':omz:update' frequency 0
|
zstyle ':omz:update' frequency 0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
By default, updates always pull the latest changes. If you'd rather let others kick the tires first
|
||||||
|
before an update reaches your machine, you can set a cooldown (in days). You'll still get everything —
|
||||||
|
just a little later:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Only apply updates that are at least 10 days old
|
||||||
|
zstyle ':omz:update' cooldown 10
|
||||||
|
```
|
||||||
|
|
||||||
### Updates Verbosity
|
### Updates Verbosity
|
||||||
|
|
||||||
You can also limit the update verbosity with the following settings:
|
You can also limit the update verbosity with the following settings:
|
||||||
|
|||||||
@@ -28,9 +28,12 @@ ZSH_THEME="robbyrussell"
|
|||||||
# zstyle ':omz:update' mode auto # update automatically without asking
|
# zstyle ':omz:update' mode auto # update automatically without asking
|
||||||
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
|
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
|
||||||
|
|
||||||
# Uncomment the following line to change how often to auto-update (in days).
|
# Uncomment the following line to change the frequency the auto-updater is run (in days).
|
||||||
# zstyle ':omz:update' frequency 13
|
# zstyle ':omz:update' frequency 13
|
||||||
|
|
||||||
|
# Uncomment the following line to set how old an update must be before it's applied, manually or via the auto-updater (in days).
|
||||||
|
# zstyle ':omz:update' cooldown 10
|
||||||
|
|
||||||
# Uncomment the following line if pasting URLs and other text is messed up.
|
# Uncomment the following line if pasting URLs and other text is messed up.
|
||||||
# DISABLE_MAGIC_FUNCTIONS="true"
|
# DISABLE_MAGIC_FUNCTIONS="true"
|
||||||
|
|
||||||
|
|||||||
@@ -231,6 +231,10 @@ local ret=0
|
|||||||
remote=${"$(git config --local oh-my-zsh.remote)":-origin}
|
remote=${"$(git config --local oh-my-zsh.remote)":-origin}
|
||||||
branch=${"$(git config --local oh-my-zsh.branch)":-master}
|
branch=${"$(git config --local oh-my-zsh.branch)":-master}
|
||||||
|
|
||||||
|
# cooldown: minimum age (in days) of commits to apply
|
||||||
|
local cooldown_days
|
||||||
|
zstyle -s ':omz:update' cooldown cooldown_days || cooldown_days=0
|
||||||
|
|
||||||
# repository state
|
# repository state
|
||||||
last_head=$(git symbolic-ref --quiet --short HEAD || git rev-parse HEAD)
|
last_head=$(git symbolic-ref --quiet --short HEAD || git rev-parse HEAD)
|
||||||
# checkout update branch
|
# checkout update branch
|
||||||
@@ -242,7 +246,20 @@ last_commit=$(git rev-parse "$branch")
|
|||||||
if [[ $verbose_mode != silent ]]; then
|
if [[ $verbose_mode != silent ]]; then
|
||||||
printf "${BLUE}%s${RESET}\n" "Updating Oh My Zsh"
|
printf "${BLUE}%s${RESET}\n" "Updating Oh My Zsh"
|
||||||
fi
|
fi
|
||||||
if LANG= git pull --quiet --rebase $remote $branch; then
|
if {
|
||||||
|
if (( cooldown_days > 0 )); then
|
||||||
|
zmodload zsh/datetime
|
||||||
|
local cutoff_epoch cooldown_ref
|
||||||
|
cutoff_epoch=$(( EPOCHSECONDS - cooldown_days * 86400 ))
|
||||||
|
LANG= git fetch --quiet $remote $branch && {
|
||||||
|
cooldown_ref=$(git log --format="%H %ct" "$remote/$branch" \
|
||||||
|
| awk -v c="$cutoff_epoch" '$2 <= c { print $1; exit }')
|
||||||
|
[[ -z "$cooldown_ref" ]] || LANG= git merge --ff-only --quiet "$cooldown_ref"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LANG= git pull --quiet --rebase $remote $branch
|
||||||
|
fi
|
||||||
|
}; then
|
||||||
# Check if it was really updated or not
|
# Check if it was really updated or not
|
||||||
if [[ "$(git rev-parse HEAD)" = "$last_commit" ]]; then
|
if [[ "$(git rev-parse HEAD)" = "$last_commit" ]]; then
|
||||||
message="Oh My Zsh is already at the latest version."
|
message="Oh My Zsh is already at the latest version."
|
||||||
|
|||||||
Reference in New Issue
Block a user