Allow to not have ~/.git-prompt.sh

This commit is contained in:
Julien Palard 2014-09-17 12:19:39 +02:00
parent 0ca50e817a
commit 1f9ddefea2
1 changed files with 12 additions and 3 deletions

15
bashrc
View File

@ -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