diff options
Diffstat (limited to 'BuildTools/Git/Hooks/pre-commit')
-rwxr-xr-x | BuildTools/Git/Hooks/pre-commit | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/BuildTools/Git/Hooks/pre-commit b/BuildTools/Git/Hooks/pre-commit index ad0945e..987f127 100755 --- a/BuildTools/Git/Hooks/pre-commit +++ b/BuildTools/Git/Hooks/pre-commit @@ -4,6 +4,15 @@ IFS=' ' echo "Checking tabs & copyrights ..." +for file in $(git diff --cached --diff-filter=A --name-only); do + if [ ! -f $file ]; then + continue + fi + if ! BuildTools/Copyrighter.py check-copyright $file; then + echo "ERROR: '$file' has a copyright error. Aborting commit." + exit -1 + fi +done for file in $(git diff --cached --name-only); do if [ ! -f $file ]; then continue @@ -12,10 +21,6 @@ for file in $(git diff --cached --name-only); do 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 if ! BuildTools/CheckHeaders.py $file; then echo "ERROR: '$file' failed header sanity test. Aborting commit." exit -1 |