From 1f9ddefea2df24115785ca1c524558a1831d4799 Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Wed, 17 Sep 2014 12:19:39 +0200 Subject: [PATCH] Allow to not have ~/.git-prompt.sh --- bashrc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index 572f3d6..4370a85 100644 --- a/bashrc +++ b/bashrc @@ -108,8 +108,14 @@ fi [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)" [ "$TERM" != 'linux' -a z"$TERM" != z'eterm-color' ] && TITLE="\[\033]0;\u@\H:\w\a\]" || TITLE='' -export PS1="$TITLE\[$USERNAME_COLOR\]\u\[$WHITE\]@\[$HOSTNAME_COLOR\]\H\[$WHITE\]"'' -export PROMPT_COMMAND='__git_ps1 "'"$PS1"'" "\\\$ "' +export PS1="$TITLE\[$USERNAME_COLOR\]\u\[$WHITE\]@\[$HOSTNAME_COLOR\]\H\[$WHITE\]" +# .git-prompt.sh is here: https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh +if [ -f ~/.git-prompt.sh ] +then + export PROMPT_COMMAND='__git_ps1 "'"$PS1"'" "\\\$ "' +else + export PS1="$PS1"'\$ ' +fi alias grep="grep --color" alias ls='ls $LS_OPTIONS' @@ -233,4 +239,7 @@ function marks ls -l "$MARKPATH" | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo } -source ~/.git-prompt.sh +if [ -f ~/.git-prompt.sh ] +then + source ~/.git-prompt.sh +fi