696638c18597eda756f88864ffabc4588ee6ebec
galt
  Wed Jun 30 19:02:44 2010 -0700
bugfixes on gilt
diff --git src/utils/gitTools/gilt src/utils/gitTools/gilt
index ab9bbde..d3f30b1 100755
--- src/utils/gitTools/gilt
+++ src/utils/gitTools/gilt
@@ -1,51 +1,50 @@
 #!/bin/bash
 
 usage='gilt [-h] [dir]
 Run git status on current or specified dir.
 
 Options:
   -h or -help - print this message'
 
 while [[ $1 == -* ]] ; do
     opt=$1
     shift
     case "$opt" in 
         -h) echo "$usage" > /dev/stderr
             exit 1 ;;
         *)  echo "Error: invalid option: $opt" > /dev/stderr
             echo "$usage" > /dev/stderr
             exit 1 ;;
     esac
 done
 
 dir="$1"
 if [ "$dir" == "" ]; then 
   dir="."
 fi
 onbranch=`git branch | grep '^[*]' | sed -e 's/* //'`
-mymaster=`git log HEAD ^origin/master | grep commit | wc -l`
-omaster=`git log ^HEAD origin/master | grep commit | wc -l`
+mymaster=`git log  HEAD ^origin/master | grep '^commit' | wc -l`
+omaster=`git  log ^HEAD  origin/master | grep '^commit' | wc -l`
 staged=`git diff --stat --cached $dir`
 dirty=`git diff --stat $dir`
 
 echo "On $onbranch branch."
 
-echo "debug:mymaster=[$mymaster]"
-
 if [ "$mymaster" > 0 ] && [ "$omaster" > 0 ]; then
-    echo "Your branch is behind 'origin/master' by $omaster commits, and can be fast-forwarded."
+    echo "Your branch and 'origin/master' have diverged,"
+    echo "and have $mymaster and $omaster different commit(s) each, respectively."
 elif (["$mymaster" == 0] && ["$omaster" > 0]); then
     echo "Your branch is behind 'origin/master' by $omaster commits, and can be fast-forwarded."
 elif (["$mymaster" > 0] && ["$omaster" == 0]); then
     echo "Your branch is ahead of 'origin/master' by $mymaster commits."
 fi
 
 if [ -n "$staged" ]; then
     echo "staged:"
     echo "$staged"
 fi
 if [ -n "$dirty" ]; then
     echo "working-dir:"
     echo "$dirty"
 fi