summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Emmanuel Gil Peyrot2016-09-18 00:59:46 +0900
committerGravatar Emmanuel Gil Peyrot2016-09-18 09:36:57 +0900
commit491f5bab88b67926a3ccf72c1c35527071a93a9b (patch)
treef36c3bb748c0eb6db9a7414434c6ed7c246855d4
parentDyncom: Disable clang-format on the decoding table. (diff)
downloadyuzu-491f5bab88b67926a3ccf72c1c35527071a93a9b.tar.gz
yuzu-491f5bab88b67926a3ccf72c1c35527071a93a9b.tar.xz
yuzu-491f5bab88b67926a3ccf72c1c35527071a93a9b.zip
Git hook: Import Dolphin’s clang-format hook.
Diffstat (limited to '')
-rwxr-xr-xhooks/pre-commit19
1 files changed, 18 insertions, 1 deletions
diff --git a/hooks/pre-commit b/hooks/pre-commit
index c100bb634..ee818b566 100755
--- a/hooks/pre-commit
+++ b/hooks/pre-commit
@@ -1,4 +1,4 @@
1#!/bin/sh 1#!/bin/bash
2 2
3# Enforce citra's whitespace policy 3# Enforce citra's whitespace policy
4git config --local core.whitespace tab-in-indent,trailing-space 4git config --local core.whitespace tab-in-indent,trailing-space
@@ -24,3 +24,20 @@ If you know what you are doing, you can try 'git commit --no-verify' to bypass t
24END 24END
25 exit 1 25 exit 1
26fi 26fi
27
28for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do
29 if ! echo "$f" | egrep -q "[.](cpp|h)$"; then
30 continue
31 fi
32 if ! echo "$f" | egrep -q "^src/"; then
33 continue
34 fi
35 d=$(diff -u "$f" <(clang-format "$f"))
36 if ! [ -z "$d" ]; then
37 echo "!!! $f not compliant to coding style, here is the fix:"
38 echo "$d"
39 fail=1
40 fi
41done
42
43exit "$fail"