install-commit-hook 349 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. if [ $# -eq 0 ]
  3. then
  4. echo "Usage: $0 YOUR-MNT"
  5. exit
  6. fi
  7. BASE="$(readlink -f "$0" 2>/dev/null || python -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$0")"
  8. BASE="$(dirname "$BASE")"
  9. cd "$BASE" || exit 1
  10. cat > .git/hooks/pre-commit <<EOF
  11. #!/bin/sh
  12. ./check-my-stuff "$1" || exit 1
  13. EOF
  14. chmod +x .git/hooks/pre-commit