Allow __git_ps1 to be used in PROMPT_COMMAND
authorSimon Oosthoek <s.oosthoek@xs4all.nl>
Wed, 10 Oct 2012 19:31:58 +0000 (21:31 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Oct 2012 18:26:14 +0000 (11:26 -0700)
commit1bfc51ac814125de03ddf1900245e42d6ce0d250
tree8588906ee06e689efffa9bb07d4eac131c8a918c
parentd64383ab14c0e728f81a32ddbb8375ba8abde14f
Allow __git_ps1 to be used in PROMPT_COMMAND

Changes __git_ps1 to allow its use as PROMPT_COMMAND in bash
in addition to setting PS1 with __git_ps1 in a command substitution.
PROMPT_COMMAND has advantages for using color without running
into prompt-wrapping issues. Only by assigning \[ and \] to PS1
directly can bash know that these and the enclosed zero-width codes in
between don't count in the length of the prompt.

Signed-off-by: Simon Oosthoek <s.oosthoek@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-prompt.sh