X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=admin%2Fprog%2Fbash_prompt;fp=admin%2Fprog%2Fbash_prompt;h=4e428f398450283bf5d72833cab7e453e776e420;hb=a429d549424241eec8d686150b92eb7f047b7f10;hp=eb152c933d7c369d68685166c8c5d26f5cf3da7d;hpb=cddce50db926951edcd3330744f0ef77c1d0ab8a;p=dotfiles.git diff --git a/admin/prog/bash_prompt b/admin/prog/bash_prompt index eb152c9..4e428f3 100644 --- a/admin/prog/bash_prompt +++ b/admin/prog/bash_prompt @@ -69,6 +69,22 @@ prompt_git() { 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