]> git.madduck.net Git - code/fbi-announce.git/blobdiff - 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:

optional variables may be empty
[code/fbi-announce.git] / post-receive-hook.sh
index b9b7d299d0f69be3088ec8872e411789d8d25e16..04198d3679e24f62c03edcd2508976583ecb4d4e 100755 (executable)
@@ -8,15 +8,21 @@
 #
 set -eu
 
-refname=$3
-rev=$(git rev-parse ${refname})
-oldhead=$1
-newhead=$2
-
 realself=$(readlink -f ${0})
 siblingscript="${realself%/*}/fbi-announce.sh"
 
-for commit in $(git rev-parse --not --branches | grep -v ${rev} |
-                git rev-list --reverse --stdin ${oldhead}..${newhead}); do
-  ${siblingscript} ${refname} ${commit}
-done
+process_update()
+{
+  for commit in $(git rev-parse --not --branches | grep -v ${rev} |
+                  git rev-list --reverse --stdin ${1}..${2}); do
+    ${siblingscript} ${3} ${commit}
+  done
+}
+
+if [ $# -eq 3 ]; then
+  process_update "${@}"
+else
+  while read oldrev newrev refname; do
+    process_update "${oldrev}" "${newrev}" "${refname}"
+  done
+fi