Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] vcs_info - git branch with % in it's name



Daniel Shahaf wrote on Mon, Dec 25, 2017 at 20:17:28 +0000:
> How about the following?  If that is the right fix then the adjacent lines will
> need similar tweaking.

That's not so straightforward.

Escaping the 'branch' value broke my post-backend hook, which was doing the
equivalent of «hook_com[branch]+="%f↑"».  That's fine; I wasn't expecting that
hack to work forever, and I can just change it to «…+=$(print -rP "%f↑")».  It
might warrant a NEWS/README entry, but otherwise, no sweat.

Next, if hook_com[staged] were escaped then settings such as «zstyle '*'
stagedstr '%Bthis is bold%b'» would stop working.  So, which hook_com keys
should be escaped and which shouldn't?  I don't see an easy way to tell.

> diff --git a/Functions/VCS_Info/VCS_INFO_formats b/Functions/VCS_Info/VCS_INFO_formats
> index 4d0dd75c2..a46a10286 100644
> --- a/Functions/VCS_Info/VCS_INFO_formats
> +++ b/Functions/VCS_Info/VCS_INFO_formats
> @@ -81,7 +81,7 @@ for i in {1..${#msgs}} ; do
>      if VCS_INFO_hook "set-message" $(( $i - 1 )) "${msgs[$i]}"; then
>          zformat -f msg ${msgs[$i]}                      \
>                          a:${hook_com[action]}           \
> -                        b:${hook_com[branch]}           \
> +                        b:${hook_com[branch]//'%'/%%}   \
>                          c:${hook_com[staged]}           \
>                          i:${hook_com[revision]}         \
>                          m:${hook_com[misc]}             \



Messages sorted by: Reverse Date, Date, Thread, Author