git-prompt.sh: allow to hide prompt for ignored pwd
commit0120b8c85c7a52b26ea7062fec349d178a4e0208
authorJess Austin <jess.austin@gmail.com>
Wed, 7 Jan 2015 01:22:27 +0000 (6 20:22 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 Jan 2015 18:30:30 +0000 (7 10:30 -0800)
tree240588564286b674cd164057738dbbb5d020002e
parent76b43094007824e9b487302c87d77779deb4a295
git-prompt.sh: allow to hide prompt for ignored pwd

Optionally set __git_ps1 to display nothing when present working
directory is ignored, triggered by the new environment variable
GIT_PS1_HIDE_IF_PWD_IGNORED. This environment variable may be
overridden on any repository by setting bash.hideIfPwdIgnored to
"false". In the absence of GIT_PS1_HIDE_IF_PWD_IGNORED this change
has no effect.

Many people manage e.g. dotfiles in their home directory with git.
This causes the prompt generated by __git_ps1 to refer to that "top
level" repo while working in any descendant directory. That can be
distracting, so this patch helps one shut off that noise.

Signed-off-by: Jess Austin <jess.austin@gmail.com>
Signed-off-by: Richard Hansen <rhansen@bbn.com>
Reviewed-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-prompt.sh
t/t9903-bash-prompt.sh