Mention what file has changed
[tor.git] / scripts / maint / pre-commit.git-hook
blob65fa99f4c4e55411049973601b36b8f09720272c
1 #!/bin/bash
3 # To install this script, copy it to .git/hooks/pre-commit in local copy of
4 # tor git repo and make sure it has permission to execute.
6 # This is pre-commit git hook script that prevents commiting your changeset if
7 # it fails our code formatting or changelog entry formatting checkers.
9 workdir=$(git rev-parse --show-toplevel)
11 cd "$workdir" || exit 1
13 set -e
15 if [ ! -z "ls ./changes/*" ]; then
16 python scripts/maint/lintChanges.py ./changes/*
19 if [ -d src/lib ]; then
20 # This is the layout in 0.3.5
21 perl scripts/maint/checkSpace.pl -C \
22 src/lib/*/*.[ch] \
23 src/core/*/*.[ch] \
24 src/feature/*/*.[ch] \
25 src/app/*/*.[ch] \
26 src/test/*.[ch] \
27 src/test/*/*.[ch] \
28 src/tools/*.[ch]
29 elif [ -d src/common]; then
30 # This was the layout before 0.3.5
31 perl scripts/maint/checkSpace.pl -C \
32 src/common/*/*.[ch] \
33 src/or/*/*.[ch] \
34 src/test/*.[ch] \
35 src/test/*/*.[ch] \
36 src/tools/*.[ch]
39 if test -e scripts/maint/checkIncludes.py; then
40 python scripts/maint/checkIncludes.py