From 82224fa7745618fa73bc0d5ca044cba654285922 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Fri, 21 May 2010 16:17:54 +0200 Subject: [PATCH] post-receive gets data via stdin Signed-off-by: martin f. krafft --- post-receive-hook.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) 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 -- 2.39.5