# HG changeset patch # User Mikael Berthe # Date 1342341616 -7200 # Node ID ee97df34536f7ab8a6fbb17bbfec858c2625544c # Parent ed98b8ea395d8afc586b8c7145febb2d39a6cd78 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. diff -r ed98b8ea395d -r ee97df34536f zshrc.d/20-prompt.zrc --- 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 }