X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=ls-not-pushed;h=8966c5928735b8a69b92ad9d8d866f8031b7ad38;hb=90e28dbc446b6b59cbf317bc54613e7fb25597ea;hp=506019032b285f5975682ef83a423b4091754756;hpb=d208ffbad2671a5c15f4795939ad80c4be6a02ad;p=git-scripts.git diff --git a/ls-not-pushed b/ls-not-pushed index 5060190..8966c59 100755 --- a/ls-not-pushed +++ b/ls-not-pushed @@ -1,5 +1,21 @@ #! /bin/sh - -exec "`dirname \"$0\"`"/do-all \ - 'test "$g" = "$d/.git" || continue; cd "$d" &&' \ - 'git branch --verbose | grep -q "ahead\|behind" && echo "$d"' +if git branch --verbose | grep -q "ahead\|behind"; then + up=`git rev-parse --abbrev-ref @{u} 2>/dev/null` + if [ -n "$up" -a "$up" != "@{u}" ]; then + set -- `git rev-list --count --left-right @{u}...HEAD` + left=$1 + right=$2 + s='' + if [ "$left" -gt 0 ]; then + s="$s-$left" + fi + if [ "$right" -gt 0 ]; then + s="$s+$right" + fi + fi + if [ -n "$s" ]; then + echo `pwd`: $s + else + pwd + fi +fi