Skip to content

Commit

Permalink
Fix remote
Browse files Browse the repository at this point in the history
Fix remote_pattern="# Your branch is (.*) '"
Fix if statement ${BASH_REMATCH[1]} == "ahead of"

# Your branch is ahead of 'origin/master' by…
# Your branch is behind 'origin/master' by…
  • Loading branch information
François LASSERRE committed Oct 28, 2013
1 parent 44952c1 commit fcfc102
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bash_gitprompt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ function parse_git_branch {
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"
remote_pattern="# Your branch is (.*) '"
diverge_pattern="# Your branch and (.*) have diverged"

if [[ ! ${git_status}} =~ "working directory clean" ]]; then
state="${RED}"
fi
# add an else if or two here if you want to get more specific
if [[ ${git_status} =~ ${remote_pattern} ]]; then
if [[ ${BASH_REMATCH[1]} == "ahead" ]]; then
if [[ ${BASH_REMATCH[1]} == "ahead of" ]]; then
remote="${YELLOW}"
else
remote="${YELLOW}"
Expand Down

0 comments on commit fcfc102

Please sign in to comment.