summaryrefslogtreecommitdiff
path: root/hooks/pre-commit
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-06-21 14:21:02 -0700
committerGravatar Yuri Kunde Schlesner2015-06-21 14:21:02 -0700
commit772ef097ead8d6be77cf00d753e8380fcac96710 (patch)
tree70e74daf5c9d3159550c36367959727b224c8bb5 /hooks/pre-commit
parentAppVeyor: update WinSCP download link with one that should never expire (diff)
parentenforce config from hook (diff)
downloadyuzu-772ef097ead8d6be77cf00d753e8380fcac96710.tar.gz
yuzu-772ef097ead8d6be77cf00d753e8380fcac96710.tar.xz
yuzu-772ef097ead8d6be77cf00d753e8380fcac96710.zip
Merge pull request #839 from Lectem/whitespacepolicy
Enforce the "no tab, use spaces" policy with a pre-commit hook.
Diffstat (limited to 'hooks/pre-commit')
-rw-r--r--hooks/pre-commit24
1 files changed, 24 insertions, 0 deletions
diff --git a/hooks/pre-commit b/hooks/pre-commit
new file mode 100644
index 000000000..bad84b14b
--- /dev/null
+++ b/hooks/pre-commit
@@ -0,0 +1,24 @@
1#!/bin/sh
2
3# Enforce citra's whitespace policy
4git config --local core.whitespace tab-in-indent,trailing-space
5
6# If there are whitespace errors, print the offending file names and fail.
7if ! git diff --cached --check; then
8 cat<<END;
9
10Error: This commit would contain trailing spaces or tabs, which is against this repo's policy.
11Please correct those issues before commiting. (Use 'git diff --check' for more details)
12If you know what you are doing, you can try 'git commit --no-verify' to bypass the check
13END
14 exit 1
15fi
16
17# Check for tabs, since tab-in-indent catches only those at the beginning of a line
18if git diff --cached | egrep '^\+.* '; then
19 cat<<END;
20Error: This commit would contain a tab, which is against this repo's policy.
21If you know what you are doing, you can try 'git commit --no-verify' to bypass the check.
22END
23 exit 1
24fi