SparkleShare/data/git-hooks/post-update

41 lines
945 B
Bash
Executable 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/travisghansen/fanout
#
#
# 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="80"
# 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