git rev-parse --short HEAD 2> /dev/null || \
printf "(unknown)")"
+ up=`git rev-parse --abbrev-ref @{u} 2>/dev/null`
+ if [ -n "$up" ]; then
+ local left right
+ set -- `git rev-list --count --left-right @{u}...@`
+ left=$1
+ right=$2
+ if [ "$left" -gt 0 -o "$right" -gt 0 ]; then
+ if [ "$left" -gt 0 ]; then
+ s="$s-$left"
+ fi
+ if [ "$right" -gt 0 ]; then
+ s="$s+$right"
+ fi
+ fi
+ fi
+
[ -n "$s" ] && s=" $s"
printf " (%s)" "$branchName$s"
fi