| #!/bin/sh | |
| # Check for Googlers not configuring their email address. | |
| # There are many examples of this in the git logs. | |
| AUTHORINFO=$(git var GIT_AUTHOR_IDENT) || exit 1 | |
| EMAIL=$(echo "${AUTHORINFO}" | sed -n 's/^.* <\(.*\)> .*$/\1/p') | |
| if [[ "${EMAIL}" == *".corp.google.com" ]]; then | |
| echo "Git is inferring your email to be ${EMAIL}. Please run:" | |
| echo " git config --global user.email ${USER}@google.com" | |
| exit 1 | |
| fi | |
| # Run a custom pre-commit hook if one exists. | |
| # | |
| # To perform additional pre-commit checks, create an executable file | |
| # 'pre-commit.dev' in the .git/hooks directory in your Fuchsia source checkout | |
| # and implement the checks there. | |
| if [[ -f ".git/hooks/pre-commit.dev" ]]; then | |
| exec .git/hooks/pre-commit.dev | |
| fi |