Files
oh-my-zsh/tools
Robby RussellandClaude Opus 5 296fbb8b69 fix(installer): back up the history file when replacing .zshrc
The .zshrc the installer moves aside is where the user's SAVEHIST lives.
Once it is gone zsh falls back to a smaller value, lib/history.zsh
raises that to 10000, and the next clean shell exit rewrites $HISTFILE
with only the most recent 10000 entries. Anything older is gone, and
unlike the .zshrc, the history file was never backed up.

Copy the history alongside .zshrc.pre-oh-my-zsh at the moment the config
is replaced, and say so in the overwrite prompt. $HISTFILE is a zsh
variable the installer cannot read, so cover both locations it is
commonly given: macOS /etc/zshrc sets ${ZDOTDIR:-$HOME}/.zsh_history,
and lib/history.zsh falls back to $HOME/.zsh_history.

This does not stop the trim itself, which is governed by SAVEHIST; it
makes the lost history recoverable.

Closes #10908

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 17:03:47 -07:00
..