From: martin f. krafft Date: Fri, 21 May 2010 14:17:54 +0000 (+0200) Subject: post-receive gets data via stdin X-Git-Url: https://git.madduck.net/code/fbi-announce.git/commitdiff_plain/82224fa7745618fa73bc0d5ca044cba654285922?ds=sidebyside post-receive gets data via stdin Signed-off-by: martin f. krafft --- 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