Skip to content

Commit

Permalink
Recover prompt coloration
Browse files Browse the repository at this point in the history
  • Loading branch information
mtnygard committed Feb 15, 2014
1 parent fb08c86 commit e678d28
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bash/git_prompt.sh
Expand Up @@ -15,11 +15,13 @@ LIGHT_GREEN="\[\033[1;32m\]"
function git_branch_and_user {
git rev-parse --git-dir &> /dev/null
git_status="$(git status 2> /dev/null)"
branch_pattern="^# On branch ([^${IFS}]*)"
remote_pattern="# Your branch is (.*) of"
diverge_pattern="# Your branch and (.*) have diverged"
if [[ ! ${git_status}} =~ "working directory clean" ]]; then
branch_pattern="^On branch ([^${IFS}]*)"
remote_pattern="Your branch is (.*) of"
diverge_pattern="Your branch and (.*) have diverged"
if [[ ! ${git_status} =~ "working directory clean" ]]; then
state=" ${RED}"
else
state=""
fi
# add an else if or two here if you want to get more specific
if [[ ${git_status} =~ ${remote_pattern} ]]; then
Expand Down

0 comments on commit e678d28

Please sign in to comment.