fix(vcs_info): avoid undefining wrapper during load transition

Co-authored-by: robbyrussell <257+robbyrussell@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-09-06 15:56:08 +00:00
committed by GitHub
co-authored by robbyrussell
parent e4172614e8
commit 61f12e078f
+7 -8
View File
@@ -60,14 +60,13 @@ if (( $+functions[VCS_INFO_formats] )); then
}
else
function VCS_INFO_formats {
functions -c VCS_INFO_formats _omz_vcs_info_formats_wrapper
unfunction VCS_INFO_formats
autoload -Uz +X regexp-replace VCS_INFO_formats 2>/dev/null || {
functions -c _omz_vcs_info_formats_wrapper VCS_INFO_formats
unfunction _omz_vcs_info_formats_wrapper
return 1
}
unfunction _omz_vcs_info_formats_wrapper
local loaded_function="$(
unfunction VCS_INFO_formats 2>/dev/null
autoload -Uz +X VCS_INFO_formats 2>/dev/null || return 1
print -r -- "$functions[VCS_INFO_formats]"
)" || return 1
functions[VCS_INFO_formats]="$loaded_function"
autoload -Uz +X regexp-replace 2>/dev/null || return 1
# We use $tmp here because it's already a local variable in VCS_INFO_formats
local PATCH='for tmp (base base-name branch misc revision subdir) hook_com[$tmp]="${hook_com[$tmp]//\%/%%}"'