Blame progit/hooks/files/post-receive

Pierre-Yves Chibon da70d9
#!/bin/bash
Pierre-Yves Chibon da70d9
#
Pierre-Yves Chibon da70d9
# author: orefalo
Pierre-Yves Chibon da70d9
Pierre-Yves Chibon da70d9
hookname=`basename $0`
Pierre-Yves Chibon da70d9
Pierre-Yves Chibon da70d9
Pierre-Yves Chibon da70d9
FILE=`mktemp`
Pierre-Yves Chibon da70d9
trap 'rm -f $FILE' EXIT
Pierre-Yves Chibon da70d9
cat - > $FILE
Pierre-Yves Chibon da70d9
Pierre-Yves Chibon da70d9
for hook in $GIT_DIR/hooks/$hookname.*
Pierre-Yves Chibon da70d9
do
Pierre-Yves Chibon da70d9
    if test -x "$hook"; then
Pierre-Yves Chibon da70d9
        cat $FILE | $hook "$@"
Pierre-Yves Chibon da70d9
        status=$?
Pierre-Yves Chibon da70d9
Pierre-Yves Chibon da70d9
        if test $status -ne 0; then
Pierre-Yves Chibon da70d9
            echo Hook $hook failed with error code $status
Pierre-Yves Chibon da70d9
            exit $status
Pierre-Yves Chibon da70d9
        fi
Pierre-Yves Chibon da70d9
    fi
Pierre-Yves Chibon da70d9
done