summaryrefslogtreecommitdiff
path: root/lib/vcs_info.zsh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2022-04-02 13:24:35 -0500
committerTuowen Zhao <ztuowen@gmail.com>2022-04-02 13:24:35 -0500
commit2023d3ab658fe8ed4dd4ca33cd5974ab8f0ad945 (patch)
tree99add95300f57806b89bd885a5f5322ce9f9ac1a /lib/vcs_info.zsh
parentcae9a2b797649379e865e6bd73bc67e294e4ac77 (diff)
parent53863e7b3ff0c2e2816e90dab3d870adebdf49c7 (diff)
downloadzsh-2023d3ab658fe8ed4dd4ca33cd5974ab8f0ad945.tar.gz
zsh-2023d3ab658fe8ed4dd4ca33cd5974ab8f0ad945.tar.bz2
zsh-2023d3ab658fe8ed4dd4ca33cd5974ab8f0ad945.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'lib/vcs_info.zsh')
-rw-r--r--lib/vcs_info.zsh15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/vcs_info.zsh b/lib/vcs_info.zsh
index 01dcd90b6..e60938c14 100644
--- a/lib/vcs_info.zsh
+++ b/lib/vcs_info.zsh
@@ -1,8 +1,11 @@
-# Impacted versions go from v5.0.3 to v5.8 (v5.8.1 is the first patched version)
-autoload -Uz is-at-least
-if is-at-least 5.8.1 || ! is-at-least 5.0.3; then
- return
-fi
+# Don't skip this file until a Zsh release does the necessary quoting.
+# This is because even though 5.8.1 undid recursive prompt_subst inside
+# prompt sequences, % characters in relevant fields will still be rendered
+# incorrectly in vcs_info, on all Zsh releases up to writing this.
+#
+# There is no release yet that does this right, since it requires changing
+# how what vcs_info hooks expect to receive. Even so, I'd rather be correct
+# and break custom vcs_info hooks than have a broken prompt.
# Quote necessary $hook_com[<field>] items just before they are used
# in the line "VCS_INFO_hook 'post-backend'" of the VCS_INFO_formats
@@ -35,7 +38,7 @@ fi
# due to malicious input as a consequence of CVE-2021-45444, which affects
# zsh versions from 5.0.3 to 5.8.
#
-autoload -Uz +X regexp-replace VCS_INFO_formats
+autoload -Uz +X regexp-replace VCS_INFO_formats 2>/dev/null || return
# We use $tmp here because it's already a local variable in VCS_INFO_formats
typeset PATCH='for tmp (base base-name branch misc revision subdir) hook_com[$tmp]="${hook_com[$tmp]//\%/%%}"'