pre-commit 857 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. # Enforce citra's whitespace policy
  3. git config --local core.whitespace tab-in-indent,trailing-space
  4. # If there are whitespace errors, print the offending file names and fail.
  5. if ! git diff --cached --check; then
  6. cat<<END;
  7. Error: This commit would contain trailing spaces or tabs, which is against this repo's policy.
  8. Please correct those issues before commiting. (Use 'git diff --check' for more details)
  9. If you know what you are doing, you can try 'git commit --no-verify' to bypass the check
  10. END
  11. exit 1
  12. fi
  13. # Check for tabs, since tab-in-indent catches only those at the beginning of a line
  14. if git diff --cached | egrep '^\+.* '; then
  15. cat<<END;
  16. Error: This commit would contain a tab, which is against this repo's policy.
  17. If you know what you are doing, you can try 'git commit --no-verify' to bypass the check.
  18. END
  19. exit 1
  20. fi