Fix git prompt when showuntrackedfiles is set
When GIT_PS1_SHOWUNTRACKEDFILES is set, the output of __git_ps1 may
contain a '%', which needs to be escaped before we can use it in the
shell prompt.
--- a/zshrc.d/20-prompt.zrc Sun Jul 15 01:58:11 2012 +0200
+++ b/zshrc.d/20-prompt.zrc Sun Jul 15 10:40:16 2012 +0200
@@ -39,6 +39,8 @@
source $ZDOTDIR/tools/git-prompt.sh > /dev/null 2>&1
function __git_prompt_info {
r=$(__git_ps1)
+ # If GIT_PS1_SHOWUNTRACKEDFILES is used, we need to escape the %
+ r=${r//\%/%%}
if [ ! -z $r ]; then echo -e "\n%Bgit%b$r"; fi
}