c46cd333655d9d460645ccbfb6c014a05c8159ee hiram Mon Feb 23 11:10:16 2015 -0800 use bash redirection instead of /dev/stderr in case of cron job operations refs #14821 diff --git src/utils/gitTools/gilt src/utils/gitTools/gilt index cf536de..ed2a68e 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 + -h) echo "$usage" 1>&2 exit 1 ;; - *) echo "Error: invalid option: $opt" > /dev/stderr - echo "$usage" > /dev/stderr + *) echo "Error: invalid option: $opt" 1>&2 + echo "$usage" 1>&2 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` 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