/data/git-hooks/post-update
Shell | 40 lines | 8 code | 6 blank | 26 comment | 0 complexity | a11f772bace7fefc1cbe27cabdb6cc3c MD5 | raw file
1#!/bin/sh 2 3# 4# This Git hook sends update message to a notification server, so 5# that manual git pushes to a repository also will be noticed by 6# SparkleShare clients. 7# 8# For information on running your own notification service: 9# https://github.com/hbons/fanout.node.js 10# 11# 12# For use with Gitolite: 13# 14# Copy this file to .gitolite/hooks/common/post-update. 15# Run "gl-setup" again. 16# 17# 18# For use with standard Git repositories: 19# 20# Copy this file to .git/hooks/post-update in 21# the remote repository 22# 23# 24# Make sure to "chmod -x" this hook after the file has been copied 25# 26 27# Change these if you run your own service somewhere 28SERVER="notifications.sparkleshare.org" 29PORT="1986" 30 31# Don't edit below this line 32exec > /dev/null 2>&1 33 34CHANNEL=$(git rev-list --reverse HEAD | head -n 1) 35MESSAGE=$(git rev-list HEAD | head -n 1) 36 37DATA="announce ${CHANNEL} ${MESSAGE}" 38echo "${DATA}\n" | socat - TCP-CONNECT:${SERVER}:${PORT} & 39 40exit 0