From c6d78edc8fd6c13f2ada2762a4a9ed9f3ad2db84 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 7 Sep 2026 07:56:48 -0700 Subject: [PATCH] fix(init): keep the revision helper's REPLY out of the global scope _omz_git_head reports through $REPLY, which stayed set for the rest of startup and could overwrite caller state or be mistaken for the result of an unrelated read. Call it inside an anonymous function that declares REPLY local. Co-Authored-By: Claude Opus 5 (1M context) --- oh-my-zsh.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 3539f058c..3dbeee01a 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -152,9 +152,13 @@ _omz_git_head() { [[ -n "$REPLY" ]] } -# Construct zcompdump OMZ metadata -_omz_git_head || REPLY="$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)" -zcompdump_revision="#omz revision: $REPLY" +# Construct zcompdump OMZ metadata. The helper reports through $REPLY, so +# call it in a scope that keeps that out of the global namespace. +() { + local REPLY + _omz_git_head || REPLY="$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)" + typeset -g zcompdump_revision="#omz revision: $REPLY" +} zcompdump_fpath="#omz fpath: $fpath" unset -f _omz_git_head