commit 1e2135f0b2ceb9ee95247fc61bad9632a9d47888 parent 18259e0e96d9373341dd8157ae397e1910d80166 Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com> Date: Thu, 10 Nov 2016 07:36:03 +0100 Check for git-sh-prompt availability Diffstat:
| M | .bashprompt | | | 23 | +++++++++++++++++++---- |
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/.bashprompt b/.bashprompt @@ -18,6 +18,11 @@ __show-hostname () esac } +__have-gitprompt () +{ + [ -f /usr/lib/git-core/git-sh-prompt ] +} + __set-title () { local title @@ -124,7 +129,12 @@ __set-prompt () PS1+=$(__fontify : dim) PS1+=$(__fontify '\w' bold blue) - PS1+=$(__fontify "$(__git_ps1 '(%s)')" red) + + if [ ${PS1_SHOWGITSTATUS} ] + then + PS1+=$(__fontify "$(__git_ps1 '(%s)')" red) + fi + PS1+=$(__fontify '\$' dim) PS1+=' ' @@ -170,8 +180,13 @@ __refresh-terminal () } -. /usr/lib/git-core/git-sh-prompt -GIT_PS1_SHOWDIRTYSTATE=t -GIT_PS1_SHOWUPSTREAM=auto +if __have-gitprompt +then + . /usr/lib/git-core/git-sh-prompt + GIT_PS1_SHOWDIRTYSTATE=t + GIT_PS1_SHOWUPSTREAM=auto + + PS1_SHOWGITSTATUS=t +fi export PROMPT_COMMAND=__refresh-terminal