summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-10-24 21:06:07 (GMT)
committerGerrit Code Review <gerrit@localhost.localdomain>2012-10-26 12:11:15 (GMT)
commite1fc03a2454767e5d8f9abe8ca7746b1e3dcfbf9 (patch)
treeefa2a5b960d8f51713c4750430c2d97354374db4 /BuildTools/Git/Hooks/pre-commit
parent698d56b68533760931ea6e1509fea73cdcf35b67 (diff)
downloadswift-e1fc03a2454767e5d8f9abe8ca7746b1e3dcfbf9.zip
swift-e1fc03a2454767e5d8f9abe8ca7746b1e3dcfbf9.tar.bz2
Only check tabs & copyright of committed files.
Change-Id: Iba37ecbf03bab9e23a1ee9c72b39ee4266ec4032
Diffstat (limited to 'BuildTools/Git/Hooks/pre-commit')
-rwxr-xr-xBuildTools/Git/Hooks/pre-commit23
1 files changed, 13 insertions, 10 deletions
diff --git a/BuildTools/Git/Hooks/pre-commit b/BuildTools/Git/Hooks/pre-commit
index 8130ad6..28bebfc 100755
--- a/BuildTools/Git/Hooks/pre-commit
+++ b/BuildTools/Git/Hooks/pre-commit
@@ -1,13 +1,16 @@
#!/bin/sh
-echo "Checking tabs ..."
-if ! BuildTools/CheckTabs.py; then
- echo "Expanded tabs found. Aborting commit."
- exit -1
-fi
+IFS='
+'
-echo "Checking copyrights ..."
-if ! BuildTools/Copyrighter.py check-all-copyrights; then
- echo "Copyright error found. Aborting commit."
- exit -1
-fi
+echo "Checking tabs & copyrights ..."
+for file in $(git diff --cached --name-only); do
+ if ! BuildTools/CheckTabs.py $file; then
+ echo "ERROR: '$file' contains expanded tabs. Aborting commit."
+ exit -1
+ fi
+ if ! BuildTools/Copyrighter.py check-copyright $file; then
+ echo "ERROR: '$file' has a copyright error. Aborting commit."
+ exit -1
+ fi
+done