mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Fail a hook if it makes modifications. Resolves #285
This commit is contained in:
parent
67f6f812c4
commit
a3f78bc165
5 changed files with 47 additions and 0 deletions
6
testing/resources/modified_file_returns_zero_repo/bin/hook.sh
Executable file
6
testing/resources/modified_file_returns_zero_repo/bin/hook.sh
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
for f in $@; do
|
||||
echo modified > "$f"
|
||||
echo "Modified: $f!"
|
||||
done
|
||||
2
testing/resources/modified_file_returns_zero_repo/bin/hook2.sh
Executable file
2
testing/resources/modified_file_returns_zero_repo/bin/hook2.sh
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env bash
|
||||
echo $@
|
||||
10
testing/resources/modified_file_returns_zero_repo/hooks.yaml
Normal file
10
testing/resources/modified_file_returns_zero_repo/hooks.yaml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
- id: bash_hook
|
||||
name: Bash hook
|
||||
entry: bin/hook.sh
|
||||
language: script
|
||||
files: ''
|
||||
- id: bash_hook2
|
||||
name: Bash hook
|
||||
entry: bin/hook2.sh
|
||||
language: script
|
||||
files: ''
|
||||
Loading…
Add table
Add a link
Reference in a new issue