4 progdir=$(\cd $(dirname $0) >/dev/null && pwd)
7 echo "$program fatal error: $*"
11 TEMPFILE=$(mktemp ${TMPDIR:-.}/commit-XXXXXX)
12 test -f "$TEMPFILE" || die "mktemp fails"
13 trap "rm -f $TEMPFILE COMMIT*" EXIT
15 # Pass through xtrace setting to commit-msg script
18 shopt -qo xtrace && SHELL+=' -x'
20 test $# -eq 0 && set -- ${progdir}/commit.*
23 readonly report_fmt='%-20s %s\n'
26 ( *.orig | *.rej ) continue ;;
30 results=$(exec 2>&1 ${SHELL} $progdir/../commit-msg $TEMPFILE)
31 case $'\n'"$results" in
32 ( *$'\nerror:'* ) OK=0 ;;
37 case $OK${f#*commit.} in
38 1ok*) printf "$report_fmt" $f: "PASS (was allowed)" ;;
39 0ok*) printf "$report_fmt" $f: "FAIL (not allowed)"; FAIL="$FAIL $f";;
40 0*) printf "$report_fmt" $f: "PASS (found error)" ;;
41 *) printf "$report_fmt" $f: "FAIL (no error)" ; FAIL="$FAIL $f";;
45 if [ -n "$FAIL" ]; then
46 echo -e "\nerror: commit-msg test(s) failed!" 1>&2
50 rm -f $TEMPFILE $TEMPFILE.*
55 ## sh-indent-after-do: 8
57 ## sh-indent-for-case-label: 0
58 ## sh-indent-for-case-alt: 8
59 ## indent-tabs-mode: t