setup-git-hooks.sh 616 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/sh
  2. # Install git hooks
  3. CHECK_FORMAT="mix format --check-formatted"
  4. WRITE_VERSION="git describe --tags --match "v*" | sed 's/^v//' | sed 's/-/+/2' > VERSION"
  5. cat <<EOF > .git/hooks/pre-commit
  6. #!/bin/sh
  7. $CHECK_FORMAT
  8. EOF
  9. cat <<EOF > .git/hooks/post-commit
  10. #!/bin/sh
  11. $WRITE_VERSION
  12. EOF
  13. cat <<EOF > .git/hooks/post-checkout
  14. #!/bin/sh
  15. $WRITE_VERSION
  16. EOF
  17. cat <<EOF > .git/hooks/post-merge
  18. #!/bin/sh
  19. $WRITE_VERSION
  20. EOF
  21. cat <<EOF > .git/hooks/post-rewrite
  22. #!/bin/sh
  23. $WRITE_VERSION
  24. EOF
  25. chmod +x .git/hooks/pre-commit .git/hooks/post-commit .git/hooks/post-checkout .git/hooks/post-merge .git/hooks/post-rewrite