Skip to content

Instantly share code, notes, and snippets.

@jborden
Created January 13, 2021 01:43
Show Gist options
  • Save jborden/57000cc2e351f057eab2642a4d417844 to your computer and use it in GitHub Desktop.
Save jborden/57000cc2e351f057eab2642a4d417844 to your computer and use it in GitHub Desktop.
James Borden pre-commit git hook
#!/bin/bash
# comment to temporarily turn off testing
git diff --exit-code
RESULT=$?
[ $RESULT -ne 0 ] && exit 1
if [[ -n $(git status --porcelain | grep ??) ]]; then
echo "There are untracked files"
exit 1
fi
lein test
RESULT=$?
[ $RESULT -ne 0 ] && exit 1
exit 0
# Uncomment to temporarily turn off testing
# exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment