summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt7
-rw-r--r--hooks/pre-commit24
2 files changed, 31 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 75f519a1d..6805ebed8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,13 @@ cmake_minimum_required(VERSION 2.8.11)
4 4
5project(citra) 5project(citra)
6 6
7if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit)
8 message(STATUS "Copying pre-commit hook")
9 file(COPY hooks/pre-commit
10 DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks
11 FILE_PERMISSIONS WORLD_EXECUTE )
12endif()
13
7if (NOT MSVC) 14if (NOT MSVC)
8 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread") 15 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread")
9 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") 16 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
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