prompt: fix untracked files for zsh
authorFelipe Contreras <felipe.contreras@gmail.com>
Sun, 21 Apr 2013 22:00:16 +0000 (15:00 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Apr 2013 01:01:37 +0000 (18:01 -0700)
We signal presense of untracked files by adding a per-cent sign '%'
to the prompt. But because '%' is used as an escape character to
introduce prompt customization in zsh (just like bash prompt uses
'\' to escape '\u', '\h', etc.), we need to say '%%' to get a
literal per-cent.

Helped-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-prompt.sh
index 341422a766efe70580817d98a574d95bd9ddebf9..d2af85403d5053ad4c6dd5d5a4761e0de9eb8838 100644 (file)
@@ -338,7 +338,7 @@ __git_ps1 ()
                           [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
                           [ -n "$(git ls-files --others --exclude-standard)" ]
                        then
-                               u="%"
+                               u="%${ZSH_VERSION+%}"
                        fi
 
                        if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then