post-merge.git-hook 879 B

1234567891011121314151617181920212223242526272829303132
  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. fi
  14. fi
  15. }
  16. check_for_script_update() {
  17. fullpath="$git_toplevel/scripts/maint/$1"
  18. git diff ORIG_HEAD HEAD --exit-code -- "$fullpath"
  19. }
  20. check_for_diffs "pre-push"
  21. check_for_diffs "pre-commit"
  22. check_for_diffs "post-merge"
  23. check_for_script_update "git-merge-forward.sh"
  24. check_for_script_update "git-pull-all.sh"
  25. check_for_script_update "git-push-all.sh"