ed4e317bbbd9966da2b4b85893c8d55c9ffbfd66

Author
Marco Trevisan <mail@3v1n0.net>
Committer
GitHub <noreply@github.com>
Date

Message

lib: don't override bigger HISTSIZE and SAVEHIST values (#8993)

oh-my-zsh Changes the HISTSIZE and SAVEHIST values to fixed sizes,
however if a bigger value is set in ~/.zshrc, it will override it,
potentially causing the user history to be deleted.

So, only set these values if no other is set and if it is lower than the
default ones.

Diff

 1diff --git a/lib/history.zsh b/lib/history.zsh
 2index 0f04de21567e139f8986c6385994d57c2dd907b4..0ee8cfe7affb8e59351da583dee883cd13868c11 100644
 3--- a/lib/history.zsh
 4+++ b/lib/history.zsh
 5@@ -27,8 +27,8 @@ esac
 6 
 7 ## History file configuration
 8 [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
 9-HISTSIZE=50000
10-SAVEHIST=10000
11+[ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000
12+[ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000
13 
14 ## History command configuration
15 setopt extended_history       # record timestamp of command in HISTFILE