/data/git-hooks/post-update
http://github.com/hbons/SparkleShare · Shell · 40 lines · 8 code · 6 blank · 26 comment · 0 complexity · a11f772bace7fefc1cbe27cabdb6cc3c MD5 · raw file
- #!/bin/sh
- #
- # This Git hook sends update message to a notification server, so
- # that manual git pushes to a repository also will be noticed by
- # SparkleShare clients.
- #
- # For information on running your own notification service:
- # https://github.com/hbons/fanout.node.js
- #
- #
- # For use with Gitolite:
- #
- # Copy this file to .gitolite/hooks/common/post-update.
- # Run "gl-setup" again.
- #
- #
- # For use with standard Git repositories:
- #
- # Copy this file to .git/hooks/post-update in
- # the remote repository
- #
- #
- # Make sure to "chmod -x" this hook after the file has been copied
- #
- # Change these if you run your own service somewhere
- SERVER="notifications.sparkleshare.org"
- PORT="1986"
- # Don't edit below this line
- exec > /dev/null 2>&1
- CHANNEL=$(git rev-list --reverse HEAD | head -n 1)
- MESSAGE=$(git rev-list HEAD | head -n 1)
- DATA="announce ${CHANNEL} ${MESSAGE}"
- echo "${DATA}\n" | socat - TCP-CONNECT:${SERVER}:${PORT} &
- exit 0