diff options
| author | 2015-05-31 13:24:23 +0200 | |
|---|---|---|
| committer | 2015-06-09 19:59:39 +0200 | |
| commit | 85183a702ab342de03d7a8d7b73e1fb0f7e346f2 (patch) | |
| tree | 4fcf5606b0a3d564ef62e28ec13aee70b5fdb5f1 /hooks | |
| parent | Merge pull request #805 from lioncash/warn (diff) | |
| download | yuzu-85183a702ab342de03d7a8d7b73e1fb0f7e346f2.tar.gz yuzu-85183a702ab342de03d7a8d7b73e1fb0f7e346f2.tar.xz yuzu-85183a702ab342de03d7a8d7b73e1fb0f7e346f2.zip | |
force no-tab/trailing spaces with git hook
Remove unneeded stuff from pre-commit script
The check against an empty commit was not needed (it is only a security for the 1st commit after git init).
It could also possibly pose problems because of the redirection to /dev/null on some windows systems.
newline at EOF & fixed indent
Diffstat (limited to 'hooks')
| -rw-r--r-- | hooks/pre-commit | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100644 index 000000000..44010fa1a --- /dev/null +++ b/hooks/pre-commit | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | #check the config, in case the user really wants to allow tabs... | ||
| 4 | allowtabs=$(git config hooks.allowtabs) | ||
| 5 | if [ "$allowtabs" != "true" ] && | ||
| 6 | git diff --cached | egrep '^\+.* ' | ||
| 7 | then | ||
| 8 | cat<<END; | ||
| 9 | Error: This commit would contain a tab, which is against this repo's policy. | ||
| 10 | END | ||
| 11 | exit 1 | ||
| 12 | fi | ||
| 13 | |||
| 14 | # If there are whitespace errors, print the offending file names and fail. | ||
| 15 | if | ||
| 16 | # Use git built-in checks for trailing whitespaces | ||
| 17 | ! git diff --check --cached | ||
| 18 | then | ||
| 19 | cat<<END; | ||
| 20 | Error: This commit would contain trailing spaces, which is against this repo's policy. | ||
| 21 | END | ||
| 22 | exit 1 | ||
| 23 | fi | ||