New advice for pre-commit filter.
Without `--diff-filter=MA` it will try to lint deletions,
and fail because the file is not present.
commit35cfe2d01b25f42f7720cbdf20a8d2205f7e80e0
authorJohn MacFarlane <jgm@berkeley.edu>
dateFri 18 Dec 2020, 12:18 (6 years ago)
parent906251e
CONTRIBUTING.md+2−1
@@ -288,7 +288,8 @@ A good way to ensure no new warnings are introduced is to use a Git
288288before creating a commit:
289289
290290 #!/bin/sh
291− git diff --cached --name-only | grep '\.hs$' | xargs hlint
291+ git diff --diff-filter=MA --cached --name-only | grep '\.hs$' | \
292+ xargs hlint --hint .hlint.yaml
292293
293294Saving this to `.git/hooks/pre-commit`, and making the script
294295executable, will prevent accidental introduction of potentially