]> git.madduck.net Git - code/fbi-announce.git/blob - post-receive-hook.sh

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

no need for html escapes
[code/fbi-announce.git] / post-receive-hook.sh
1 #!/bin/sh
2 #
3 # post-receive-hook — a post-receive hook to invoke fbi-announce
4 #
5 # Copyright © 2009–2010 martin f. krafft <madduck@debian.org>
6 #
7 # Distributed under the terms of the Artistic Licence 2.0
8 #
9 #
10 # Link this to $GIT_DIR/hooks/post-receive (or …/update).
11 #
12 set -eu
13
14 realself=$(readlink -f ${0})
15 siblingscript="${realself%/*}/fbi-announce.sh"
16
17 process_update()
18 {
19   for commit in $(git rev-parse --not --branches |
20                     grep -v $(git rev-parse ${3}) |
21                     git rev-list --reverse --stdin ${1}..${2}); do
22     ${siblingscript} ${3} ${commit}
23   done
24 }
25
26 if [ $# -eq 3 ]; then
27   process_update "${@}"
28 else
29   while read oldrev newrev refname; do
30     process_update "${oldrev}" "${newrev}" "${refname}"
31   done
32 fi