#!/bin/sh

set -e

if [ -z "$(git config --get irker.project)" -a -z "$(git config --get irker.template)" ]
then
   echo "CONFIGURATION ERROR: Neither irker.project nor irker.template defined"
   echo "NOT sending IRC notification"
	exit 0
fi

echo "sending IRC notification"

while read old new refname
do
	irkerhook --refname=${refname} $(git rev-list --reverse ${old}..${new})
done
