Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] vcs_info - git branch with % in it's name
- X-seq: zsh-workers 42166
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Doron Behar <doron.behar@xxxxxxxxx>
- Subject: Re: [BUG] vcs_info - git branch with % in it's name
- Date: Mon, 25 Dec 2017 20:17:28 +0000
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=h4Ri2T tfGReicq1EeEmNvBMUE2915j23FKRTRJxApq8=; b=EnBiagUv2hV3CfAmStyb5f SbTB9vzxsotv41CCJ0hbhZGAa1gabpA1HgtbfIeAvBHFGHS9zolebY+i23Inzn+3 VDst/+p4k3WYgIFlR3sUs2iKVFPqvlka/Yhql6SMZUSexzOGqcBu+VqNg3W+HTM/ k6dXghTNdMO3pNWgzfRcKrH3h5Uxb8zlnbClFR5SI/eN17w+URvc7sy076SwApNg gQVZMFaGkywcgNTIhoTcQaMmiqODKTe5GNN7OCy2Z1VoCAYtnsO/Cu2ckBakwO8D 75Xjylda2v+TFfad7a1XxpMEFnteDZFWNunlsynUQ6b98YkY4951eKl/PdWEkNzA ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=h4Ri2T tfGReicq1EeEmNvBMUE2915j23FKRTRJxApq8=; b=DzVzlmRdT/rWo0/3prt5B1 TXBPTaxkEKQFTphC74Si5AvnPmWTccWiaJ2TL9EBU7Hic2OqDLymUHNjJV3FBy9j nBvkmvUh2ISRkkBiMTFQvT7KW8OWszmuX50uPXMBHtRYRp8COx6uHNwEBWzw6D51 ZAGC7eVDU1XuKjoRM9N5KsuHlYotnONspwJfIghOmeN71SwPoF+gfq5lKdKfFg4q Bmm2SMJhNopHmUIZIygFHAbXZjC4tbu2z7bYn3qf4yqS8ZHZD358RAS5JGfbUIS+ VeEgoGeIErBBTOnjSGeLAEWeyQRrP5CVHxpJoTG7a5KcCyVTf2RpGyMJOTJ1RVSA ==
- In-reply-to: <20171225093306.6druy3zqyjx2rcyr@NUC.localdomain>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20171225093306.6druy3zqyjx2rcyr@NUC.localdomain>
Doron Behar wrote on Mon, 25 Dec 2017 11:33 +0200:
> I think I found a bug within zsh's module vcs_info.
>
> If a user is in a git repository with a '%' as part of the name of the
> branch and he has '%b' in his prompt, he might get weird results, like:
>
> doron bla9269ello ~/repos/abcde
>
> Instead of:
>
> doron bla%ello ~/repos/abcde
>
> Has anyone encountered this before? I wonder why it happens..
Prompt expansions and zformat both use % as an expando introducer. This is
basically the same form of bug as doing *«printf(argv[1])» in C. %h is:
%h
%! Current history event number.
(Incidentally, it is missing from «print -P %<TAB>» completion)
How about the following? If that is the right fix then the adjacent lines will
need similar tweaking.
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]} \
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author