be3ca74be95c4f6ae48f211f102a968415edb84e
galt
  Wed Jun 30 19:14:00 2010 -0700
handling plurals for gilt
diff --git src/utils/gitTools/gilt src/utils/gitTools/gilt
index f545871..b642736 100755
--- src/utils/gitTools/gilt
+++ src/utils/gitTools/gilt
@@ -1,50 +1,60 @@
 #!/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`
 staged=`git diff --stat --cached $dir`
 dirty=`git diff --stat $dir`
 
 echo "On $onbranch branch."
 
 if [ "$mymaster" -gt "0" ] && [ "$omaster" -gt "0" ]; then
     echo "Your branch and 'origin/master' have diverged,"
     echo "and have $mymaster and $omaster different commit(s) each, respectively."
 elif [ "$mymaster" -eq "0" ] && [ "$omaster" -gt "0" ]; then
-    echo "Your branch is behind 'origin/master' by $omaster commits, and can be fast-forwarded."
+    if [ "$omaster" -eq "1" ]; then
+	plural=""
+    else
+	plural="s"
+    fi
+    echo "Your branch is behind 'origin/master' by $omaster commit$plural, and can be fast-forwarded."
 elif [ "$mymaster" -gt "0" ] && [ "$omaster" -eq "0" ]; then
-    echo "Your branch is ahead of 'origin/master' by $mymaster commits."
+    if [ "$mymaster" -eq "1" ]; then
+	plural=""
+    else
+	plural="s"
+    fi
+    echo "Your branch is ahead of 'origin/master' by $mymaster commit$plural."
 fi
 
 if [ -n "$staged" ]; then
     echo "staged:"
     echo "$staged"
 fi
 if [ -n "$dirty" ]; then
     echo "working-dir:"
     echo "$dirty"
 fi