aa90bf4cb47af0436e2e3f9fd076f7562baa9894 galt Wed Jun 30 19:37:13 2010 -0700 backing off on the pathspec limitation of staged stuff, since it is fast for git to generate and it is important to know what would get committed diff --git src/utils/gitTools/gilt src/utils/gitTools/gilt index b642736..cf536de 100755 --- src/utils/gitTools/gilt +++ src/utils/gitTools/gilt @@ -1,60 +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` +staged=`git diff --stat --cached` 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 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 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