aboutsummaryrefslogtreecommitdiff
path: root/contrib/pre-commit/whitespace
blob: ee588ccfdeff0fd85f0ce6ef7bcffbd9c0d0e1a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash -e

function run_test {
    if git rev-parse --verify HEAD >/dev/null 2>&1 ; then
        head="HEAD"
    else
        # First commit, use an empty tree
        head="4b825dc642cb6eb9a060e54bf8d69288fbee4904"
    fi
    git diff-index --check --cached "${head}" --
}

case "${1}" in
    --about )
        echo "Check for introduced trailing whitespace or an indent that uses a space before a tab."
        ;;
    * )
        run_test
        ;;
esac