Restructure
[gitolite-hooks.git] / irker
1 #!/bin/bash
2
3 IRKERPATH=/usr/bin/
4
5 function help_irker() {
6   echo "Required config settings:"
7   echo "  git config irker.channels 'channel1 channel2 ..'"
8   echo "  git config irker.project 'Project name'"
9   echo "  git config irker.server 'server'"
10   echo "  git config irker.server 'server'"
11 }
12
13
14 function notify_irker() {
15    old=$1
16    new=$2
17    refname=$3
18
19    echo "irker $1 $2 $3"
20    return 
21
22    if [ "x$old" = "x0000000000000000000000000000000000000000" ]; then
23       # We're pushing into an empty repo, so we need a different command
24       # to get the rev list
25       # This does the wrong thing if the parent of the branch isn't master
26       # but it is kind of correct most of the time
27       ${IRKERPATH}/irkerhook --refname=${refname} \
28            $(git rev-list $new --not master)
29    elif [ "x$new" = "x0000000000000000000000000000000000000000" ]; then
30       # We're deleting a branch - we need to do the right thing
31       # (whatever that is)
32       # This is not the right thing, but will do for now
33       repo=$(basename $PWD | sed 's/.git$//' )
34       for channel in $(git config --get irker.channels | sed "s/,/ /"); do
35          ${IRKERPATH}/irk $channel "$repo: Deleted branch $refname"
36       done
37    else
38       ${IRKERPATH}/irkerhook --refname=${refname} \
39            $(git rev-list --reverse ${old}..${new})
40    fi
41 }