use the current branch for checking if there is pending commits

This commit is contained in:
nojhan 2012-04-28 10:38:20 +02:00
commit f10a421d3f

View file

@ -104,11 +104,12 @@ git_branch_color()
color=""
if git diff --quiet 2>/dev/null >&2 ; then
has_commit=`git rev-list origin/master..master`
if [ "$has_commit" == "" ] ; then
color="${green}" # nothing to commit or push
else
branch=$(git_branch)
has_commit=`git rev-list origin/$branch..$branch`
if [ "$has_commit" != "" ] ; then
color="${yellow}" # some commits to push
else
color="${green}" # nothing to commit or push
fi
else
color="${red}" # changes to commit