mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-09-23 19:46:05 +02:00
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) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a8da200b18
commit
c6d78edc8f
+7
-3
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user