07b829c894738e4ad594dc5f8d73401fbd83f203

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(vcs_info): quote % in relevant fields on all current Zsh releases

Diff

 1diff --git a/lib/vcs_info.zsh b/lib/vcs_info.zsh
 2index 01dcd90b601dd940296087ac61bd56ec1ceb50ef..edb515ce04b28d50daa7f2e4b072d50e05f5366c 100644
 3--- a/lib/vcs_info.zsh
 4+++ b/lib/vcs_info.zsh
 5@@ -1,8 +1,11 @@
 6-# Impacted versions go from v5.0.3 to v5.8 (v5.8.1 is the first patched version)
 7-autoload -Uz is-at-least
 8-if is-at-least 5.8.1 || ! is-at-least 5.0.3; then
 9-  return
10-fi
11+# Don't skip this file until a Zsh release does the necessary quoting.
12+# This is because even though 5.8.1 undid recursive prompt_subst inside
13+# prompt sequences, % characters in relevant fields will still be rendered
14+# incorrectly in vcs_info, on all Zsh releases up to writing this.
15+#
16+# There is no release yet that does this right, since it requires changing
17+# how what vcs_info hooks expect to receive. Even so, I'd rather be correct
18+# and break custom vcs_info hooks than have a broken prompt.
19 
20 # Quote necessary $hook_com[<field>] items just before they are used
21 # in the line "VCS_INFO_hook 'post-backend'" of the VCS_INFO_formats