From: Antoine Beaupré Date: Sun, 1 Dec 2013 06:39:07 +0000 (-0500) Subject: add a more helpful hook example: in post-receive X-Git-Tag: 2.4~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4d730bc5dc9320f6885b7c269df12feed5c4510d;p=irker.git add a more helpful hook example: in post-receive the previous suggestion seemed to be about the update hook, but it's usually bad practice to setup notification hooks there, because if they fail, the push fails. parsing the git documentation to find exactly the incantation is not exactly trivial either... --- diff --git a/irkerhook.xml b/irkerhook.xml index 886b006..b54560c 100644 --- a/irkerhook.xml +++ b/irkerhook.xml @@ -193,6 +193,20 @@ irkerhook.py --refname=refs/heads/master HEAD However, this will not give the right result when you push to a non-default branch of a bare repo. +A typical way to install this hook is actually in the +post-receive hook, because it gets all the +necessary details and will not abort the push on failure. Use the +following script: + + +#!/bin/sh + +echo "sending IRC notification" +while read old new refname; do + irkerhook --refname=${refname} $(git rev-list --reverse ${old}..${new}) +done + + Preferences may be set in the repo config file in an [irker] section. Here is an example of what that can look like: