diff --git a/shell/dot-bashrc b/shell/dot-bashrc index eeeb0bc..1de9777 100644 --- a/shell/dot-bashrc +++ b/shell/dot-bashrc @@ -13,8 +13,22 @@ parse_git_branch() { local b=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') if [ "$b" != "" ] then + local behind=$(git rev-list HEAD...@{u} --ignore-submodules --count 2>/dev/null) + local ahead=$(git rev-list @{u}...HEAD --ignore-submodules --count 2>/dev/null) git diff --cached --exit-code &> /dev/null || b="${b}+" git diff --exit-code &> /dev/null || b="${b}*" + if [[ "$behind" > 0 || "$ahead" > 0 ]] + then + b="$b ☁ " + if [[ "$ahead" > 0 ]] + then + b="$b+$ahead" + fi + if [[ "$behind" > 0 ]] + then + b="$b-$behind" + fi + fi fi echo -n "$b" }