1#!/bin/sh
2
3# Enforce yuzu's whitespace policy
4git config --local core.whitespace tab-in-indent,trailing-space
5
6paths_to_check="src/ CMakeLists.txt"
7
8# If there are whitespace errors, print the offending file names and fail.
9if ! git diff --cached --check -- $paths_to_check ; then
10    cat<<END
11
12Error: This commit would contain trailing spaces or tabs, which is against this repo's policy.
13Please correct those issues before committing. (Use 'git diff --check' for more details)
14If you know what you are doing, you can try 'git commit --no-verify' to bypass the check
15END
16    exit 1
17fi
18
19# Check for tabs, since tab-in-indent catches only those at the beginning of a line
20if git diff --cached -- $paths_to_check | egrep '^\+.*	'; then
21    cat<<END
22Error: This commit would contain a tab, which is against this repo's policy.
23If you know what you are doing, you can try 'git commit --no-verify' to bypass the check.
24END
25    exit 1
26fi
27