]> 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:

a5df638063d6882b75a3256697ae4266bc98d03c
[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 set -eu
10
11 realself=$(readlink -f ${0})
12 siblingscript="${realself%/*}/fbi-announce.sh"
13
14 process_update()
15 {
16   for commit in $(git rev-parse --not --branches |
17                     grep -v $(git rev-parse ${3}) |
18                     git rev-list --reverse --stdin ${1}..${2}); do
19     ${siblingscript} ${3} ${commit}
20   done
21 }
22
23 if [ $# -eq 3 ]; then
24   process_update "${@}"
25 else
26   while read oldrev newrev refname; do
27     process_update "${oldrev}" "${newrev}" "${refname}"
28   done
29 fi