diff options
Diffstat (limited to 'tools/pre-commit')
-rw-r--r-- | tools/pre-commit | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/pre-commit b/tools/pre-commit new file mode 100644 index 00000000..8f91779d --- /dev/null +++ b/tools/pre-commit | |||
@@ -0,0 +1,17 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | # | ||
3 | # An example hook script to verify what is about to be committed. | ||
4 | # Called by "git commit" with no arguments. The hook should | ||
5 | # exit with non-zero status after issuing an appropriate message if | ||
6 | # it wants to stop the commit. | ||
7 | # | ||
8 | # To enable this hook, rename this file to "pre-commit". | ||
9 | |||
10 | for file in `git diff-index --diff-filter=ACMR --name-only HEAD`; do | ||
11 | if [[ $file == *.c || $file == *.h ]] | ||
12 | then | ||
13 | echo $file | ||
14 | `which astyle` $file --options=tools/astylerc | ||
15 | git add $file | ||
16 | fi | ||
17 | done \ No newline at end of file | ||