post-merge.git-hook 638 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. git_toplevel=$(git rev-parse --show-toplevel)
  3. check_for_diffs() {
  4. installed="$git_toplevel/.git/hooks/$1"
  5. latest="$git_toplevel/scripts/maint/$1.git-hook"
  6. if [ -e "$installed" ]
  7. then
  8. if ! cmp "$installed" "$latest" >/dev/null 2>&1
  9. then
  10. echo "ATTENTION: $1 hook has changed:"
  11. echo "==============================="
  12. diff "$installed" "$latest"
  13. exit 1
  14. fi
  15. fi
  16. }
  17. check_for_diffs "pre-push"
  18. check_for_diffs "pre-commit"
  19. check_for_diffs "post-merge"