]> git.phdru.name Git - git-scripts.git/blobdiff - ls-not-pushed
Feat(submodules/remove): Add option `-c`
[git-scripts.git] / ls-not-pushed
index 9834b6063658bb342aa63ac024da1b62ae522099..4cbd831713773fad4b39c3cd8ec6c939bffb0bd7 100755 (executable)
@@ -1,6 +1,21 @@
 #! /bin/sh
-
-exec "`dirname \"$0\"`"/do-all \
-   'test "$g" = "$d/.git" || continue; cd "$d" &&' \
-   'test -n "`git status --branch --untracked-files=no |
-      grep "ahead\|behind"`" && echo "$d"'
+if git branch --verbose | grep -q "\(ahead\|behind\) [0-9]"; 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