mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-09-22 19:16:07 +02:00
lib/vcs_info.zsh loaded VCS_INFO_formats and regexp-replace and patched the function body on every startup, although only themes that call vcs_info ever need it. Define a VCS_INFO_formats wrapper that loads and patches the real function the first time it's called, then replaces itself with it. `autoload` doesn't override an existing function, so the wrapper survives a theme's `autoload -Uz vcs_info` and vcs_info's own autoload of VCS_INFO_*. Verified that a branch named `evil%n%m` still renders literally after prompt expansion, as with the eager patch (CVE-2021-45444 mitigation). Measured on macOS arm64, zsh 5.9: 1.6 ms -> 0.1 ms per interactive start. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>