zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Cc: Doron Behar <doron.behar@gmail.com>
Subject: Re: [BUG] vcs_info - git branch with % in it's name
Date: Sat, 30 Dec 2017 08:56:06 +0000	[thread overview]
Message-ID: <20171230085606.oxjfq37p3hwv37ug@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20171225201728.6e2iwqm5loqbbjsr@tarpaulin.shahaf.local2>

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]}             \


      reply	other threads:[~2017-12-30  8:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-25  9:33 Doron Behar
2017-12-25 20:17 ` Daniel Shahaf
2017-12-30  8:56   ` Daniel Shahaf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171230085606.oxjfq37p3hwv37ug@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=doron.behar@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).