/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

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