summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lectem2015-06-13 22:20:56 +0200
committerGravatar Lectem2015-06-14 00:29:56 +0200
commit499171ca64bcb32b0c2360daa505f84b62032d7a (patch)
tree18e0cd5f18464bf133c388dbf0524313697450fa
parentforce no-tab/trailing spaces with git hook (diff)
downloadyuzu-499171ca64bcb32b0c2360daa505f84b62032d7a.tar.gz
yuzu-499171ca64bcb32b0c2360daa505f84b62032d7a.tar.xz
yuzu-499171ca64bcb32b0c2360daa505f84b62032d7a.zip
enforce config from hook
Diffstat (limited to '')
-rw-r--r--.gitconfig2
-rw-r--r--hooks/pre-commit33
2 files changed, 17 insertions, 18 deletions
diff --git a/.gitconfig b/.gitconfig
deleted file mode 100644
index 4cab7f2d9..000000000
--- a/.gitconfig
+++ /dev/null
@@ -1,2 +0,0 @@
1[core]
2 whitespace = blank-at-eol,trailing-space,tab-in-indent
diff --git a/hooks/pre-commit b/hooks/pre-commit
index 44010fa1a..bad84b14b 100644
--- a/hooks/pre-commit
+++ b/hooks/pre-commit
@@ -1,23 +1,24 @@
1#!/bin/sh 1#!/bin/sh
2 2
3#check the config, in case the user really wants to allow tabs... 3# Enforce citra's whitespace policy
4allowtabs=$(git config hooks.allowtabs) 4git config --local core.whitespace tab-in-indent,trailing-space
5if [ "$allowtabs" != "true" ] && 5
6 git diff --cached | egrep '^\+.* ' 6# If there are whitespace errors, print the offending file names and fail.
7then 7if ! git diff --cached --check; then
8 cat<<END; 8 cat<<END;
9Error: This commit would contain a tab, which is against this repo's policy. 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
10END 13END
11 exit 1 14 exit 1
12fi 15fi
13 16
14# If there are whitespace errors, print the offending file names and fail. 17# Check for tabs, since tab-in-indent catches only those at the beginning of a line
15if 18if git diff --cached | egrep '^\+.* '; then
16# Use git built-in checks for trailing whitespaces 19 cat<<END;
17 ! git diff --check --cached 20Error: This commit would contain a tab, which is against this repo's policy.
18then 21If you know what you are doing, you can try 'git commit --no-verify' to bypass the check.
19 cat<<END;
20Error: This commit would contain trailing spaces, which is against this repo's policy.
21END 22END
22 exit 1 23 exit 1
23fi 24fi