diff options
author | Jeff Bradberry <jeff.bradberry@gmail.com> | 2021-05-12 17:54:17 +0200 |
---|---|---|
committer | Jeff Bradberry <jeff.bradberry@gmail.com> | 2021-05-12 17:54:17 +0200 |
commit | 1e5a0dc7c5c0552695a2ff3fcbcbfdb713c8c68b (patch) | |
tree | 5194039bb9f3bbb274adda28ce64de677d5e3a59 /pre-commit.sh | |
parent | Merge pull request #10174 from jbradberry/remove-isolated-instances (diff) | |
download | awx-1e5a0dc7c5c0552695a2ff3fcbcbfdb713c8c68b.tar.xz awx-1e5a0dc7c5c0552695a2ff3fcbcbfdb713c8c68b.zip |
Break out the pre-commit hook into an explicit script
This means that
- we don't have to be always updating the underlying .git/hooks/pre-commit file
- updates to the logic will just work automatically
- the logic of the black logic has been fixed so that AWX_IGNORE_BLACK=1 should work right now
Diffstat (limited to 'pre-commit.sh')
-rwxr-xr-x | pre-commit.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pre-commit.sh b/pre-commit.sh new file mode 100755 index 0000000000..24393c790b --- /dev/null +++ b/pre-commit.sh @@ -0,0 +1,8 @@ +#!/usr/bin/bash + +if [ -z $AWX_IGNORE_BLACK ] +then + black --check $(git diff --cached --name-only --diff-filter=AM | grep -E '\.py') || \ + (echo 'To fix this, run `make black` to auto-format your code prior to commit, or set AWX_IGNORE_BLACK=1' && \ + exit 1) +fi |