summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-09-17 17:59:46 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-09-18 02:36:57 +0200
commit491f5bab88b67926a3ccf72c1c35527071a93a9b (patch)
treef36c3bb748c0eb6db9a7414434c6ed7c246855d4
parentDyncom: Disable clang-format on the decoding table. (diff)
downloadyuzu-491f5bab88b67926a3ccf72c1c35527071a93a9b.tar
yuzu-491f5bab88b67926a3ccf72c1c35527071a93a9b.tar.gz
yuzu-491f5bab88b67926a3ccf72c1c35527071a93a9b.tar.bz2
yuzu-491f5bab88b67926a3ccf72c1c35527071a93a9b.tar.lz
yuzu-491f5bab88b67926a3ccf72c1c35527071a93a9b.tar.xz
yuzu-491f5bab88b67926a3ccf72c1c35527071a93a9b.tar.zst
yuzu-491f5bab88b67926a3ccf72c1c35527071a93a9b.zip
-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 @@
-#!/bin/sh
+#!/bin/bash
# Enforce citra's whitespace policy
git 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
END
exit 1
fi
+
+for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do
+ if ! echo "$f" | egrep -q "[.](cpp|h)$"; then
+ continue
+ fi
+ if ! echo "$f" | egrep -q "^src/"; then
+ continue
+ fi
+ d=$(diff -u "$f" <(clang-format "$f"))
+ if ! [ -z "$d" ]; then
+ echo "!!! $f not compliant to coding style, here is the fix:"
+ echo "$d"
+ fail=1
+ fi
+done
+
+exit "$fail"