diff options
| author | Lex Neva <github.com@lexneva.name> | 2022-04-28 22:53:19 -0400 |
|---|---|---|
| committer | Kaalleen <reni@allenka.de> | 2022-05-04 19:18:33 +0200 |
| commit | 1140be3cefcf070b03fd219c64a1f015db5ef510 (patch) | |
| tree | 8269c8071a6d9e30fd906a05d9b29910c0fccdd1 /bin/git-pre-commit-hook | |
| parent | f4e1bbc7d7697f994add0baa0f2749ed7d02c0d5 (diff) | |
only check style on lines changed by commit
Diffstat (limited to 'bin/git-pre-commit-hook')
| -rwxr-xr-x | bin/git-pre-commit-hook | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/bin/git-pre-commit-hook b/bin/git-pre-commit-hook index 2a65775a..81ace2cd 100755 --- a/bin/git-pre-commit-hook +++ b/bin/git-pre-commit-hook @@ -9,14 +9,9 @@ cd $(dirname "$0")/../.. -IFS=$'\n' -files=( $(git diff-index --cached --name-only --diff-filter=AMCR HEAD) ) +errors=$(git diff --cached | bin/style-check --diff 2>&1) -if [ "${#files}" -gt 0 ]; then - errors=$(bin/style-check "${files[@]}" 2>&1) - - if [ "$?" != "0" ]; then - echo "$errors" - exit 1 - fi +if [ "$?" != "0" ]; then + echo "$errors" + exit 1 fi |
