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

post-receive gets data via stdin
[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 | grep -v ${rev} |
17                   git rev-list --reverse --stdin ${1}..${2}); do
18     ${siblingscript} ${3} ${commit}
19   done
20 }
21
22 if [ $# -eq 3 ]; then
23   process_update "${@}"
24 else
25   while read oldrev newrev refname; do
26     process_update "${oldrev}" "${newrev}" "${refname}"
27   done
28 fi