]> git.phdru.name Git - git-scripts.git/blob - ls-not-pushed
Refactor(ls-not-pushed): Show behind/ahead counters
[git-scripts.git] / ls-not-pushed
1 #! /bin/sh
2 if git branch --verbose | grep -q "ahead\|behind"; then
3   up=`git rev-parse --abbrev-ref @{u} 2>/dev/null`
4   if [ -n "$up" -a "$up" != "@{u}" ]; then
5       set -- `git rev-list --count --left-right @{u}...HEAD`
6       left=$1
7       right=$2
8       s=''
9       if [ "$left" -gt 0 ]; then
10           s="$s-$left"
11       fi
12       if [ "$right" -gt 0 ]; then
13           s="$s+$right"
14       fi
15   fi
16   if [ -n "$s" ]; then
17      echo `pwd`: $s
18   else
19      pwd
20   fi
21 fi