#!/bin/sh # # post-receive-hook — a post-receive hook to invoke fbi-announce # # Copyright © 2009–2010 martin f. krafft # # Distributed under the terms of the Artistic Licence 2.0 # # # Link this to $GIT_DIR/hooks/post-receive (or …/update). # set -eu realself=$(readlink -f ${0}) siblingscript="${realself%/*}/fbi-announce.sh" process_update() { for commit in $(git rev-parse --not --branches | grep -v $(git rev-parse ${3}) | git rev-list --reverse --stdin ${1}..${2}); do ${siblingscript} ${3} ${commit} done } if [ $# -eq 3 ]; then process_update "${@}" else while read oldrev newrev refname; do process_update "${oldrev}" "${newrev}" "${refname}" done fi