]> git.armaanb.net Git - bin.git/blobdiff - git-check
xsel: new script
[bin.git] / git-check
index 7e85792ed5d95751bd4e252577b5e5a74d19383c..852624d34be101201f31ad0be9030579599066a7 100755 (executable)
--- a/git-check
+++ b/git-check
@@ -1,15 +1,20 @@
-#!/usr/bin/env bash
-for i in $(ls); do
-  cd $i
-  if [[ ! ($(git diff --stat) == "") ]]; then
-    echo $i
-    chars=${#i}
-    for (( i = 1; i < $chars; i++ )); do
-      echo -n "="
-    done
-    echo "="
-    git diff --stat
-    echo
-  fi
-  cd ..
+#!/usr/bin/env sh
+# Go into each subdirectory and run a git stat
+
+for i in ${1:-.}/*; do
+               if [ -d $i/.git ]; then
+                               stat=$(git -C $i diff --stat)
+                               if [ -n "$stat" ]; then
+                                               echo $i
+                                               chars=${#i}
+                                               j=0;
+                                               while [ "$j" -le "$chars" ]; do
+                                                               echo -n "="
+                                                               j=$(( j + 1 ))
+                                               done
+                                               echo
+                                               git -C $i diff --stat
+                                               echo
+                               fi
+               fi
 done