homebysix / pre-commit-macadmin

Pre-commit hooks for Mac admins.
63 stars 14 forks source link

Unhandled exception in check-git-config-email #58

Closed sadikkuzu closed 2 years ago

sadikkuzu commented 2 years ago

When git config --get user.email returns non-zero exit status, check-git-config-email should handle this situation.

To reproduce:

docker run -it --rm python:latest bash -xc '\
cd ; \
pip install pre-commit ; \
git clone https://github.com/homebysix/pre-commit-macadmin.git ; \
cd pre-commit-macadmin ; \
git checkout --track origin/dev; \
pre-commit autoupdate; \
pre-commit run -a; \
echo "  - repo: https://github.com/homebysix/pre-commit-macadmin" >> .pre-commit-config.yaml; \
echo "    rev: v1.12.2" >> .pre-commit-config.yaml; \
echo "    hooks:" >> .pre-commit-config.yaml; \
echo "    -   id: check-git-config-email" >> .pre-commit-config.yaml; \
echo "        args:" >> .pre-commit-config.yaml; \
echo "          - \"--domains\"" >> .pre-commit-config.yaml; \
echo "          - \"acme.com\"" >> .pre-commit-config.yaml; \
echo "          - \"paramount.com\"" >> .pre-commit-config.yaml; \
echo "        always_run: true" >> .pre-commit-config.yaml; \
echo "        exclude: ^$" >> .pre-commit-config.yaml; \
pre-commit run -a; \
git config --global user.email; \
echo $?;'
image
homebysix commented 2 years ago

This should be fixed in 1.12.3. Thanks!

[INFO] Initializing environment for https://github.com/homebysix/pre-commit-macadmin.
[INFO] Installing environment for https://github.com/homebysix/pre-commit-macadmin.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
check python ast.........................................................Passed
check BOM - deprecated: use fix-byte-order-marker........................Passed
check for case conflicts.................................................Passed
check docstring is first.................................................Passed
check that executables have shebangs.....................................Passed
check for merge conflicts................................................Passed
check yaml...............................................................Passed
fix end of files.........................................................Passed
fix python encoding pragma...............................................Passed
mixed line ending........................................................Passed
don't commit to branch...................................................Passed
trim trailing whitespace.................................................Passed
black....................................................................Passed
Check Git Config Email...................................................Failed
- hook id: check-git-config-email
- exit code: 1

Git config email is not set.

+ git config --global user.email
+ echo 1
1