summaryrefslogtreecommitdiff
path: root/script/git-hooks/check-trailing-whitespace
blob: 5303f1fcefa174900c3f121b4baf21698f007b40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

git diff-index --cached --check  HEAD -- :/*.[ch] :/*.p[ylm]

if [ $? != 0 ]; then
    echo
    echo "The commit failed because it seems to introduce trailing whitespace"
    echo "into C, Perl, or Python code."
    echo
    echo "If you are sure you want to do this, repeat the commit with the "
    echo "--no-verify, like this:"
    echo
    echo "   git commit --no-verify"
    exit 1
fi

exit 0