X-Git-Url: https://git.madduck.net/code/fbi-announce.git/blobdiff_plain/901d9ab7629f0ac984349ec6ee70441feec7bbb6..82224fa7745618fa73bc0d5ca044cba654285922:/post-receive-hook.sh diff --git a/post-receive-hook.sh b/post-receive-hook.sh index b9b7d29..04198d3 100755 --- a/post-receive-hook.sh +++ b/post-receive-hook.sh @@ -8,15 +8,21 @@ # set -eu -refname=$3 -rev=$(git rev-parse ${refname}) -oldhead=$1 -newhead=$2 - realself=$(readlink -f ${0}) siblingscript="${realself%/*}/fbi-announce.sh" -for commit in $(git rev-parse --not --branches | grep -v ${rev} | - git rev-list --reverse --stdin ${oldhead}..${newhead}); do - ${siblingscript} ${refname} ${commit} -done +process_update() +{ + for commit in $(git rev-parse --not --branches | grep -v ${rev} | + 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