diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-02-21 13:35:33 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-02-21 13:35:33 -0500 |
commit | b3b737b8750b2063c5be260287088defbfadd1b9 (patch) | |
tree | 34e7a323a21e684de7b4a7c9aa6cfd0b6bd65e12 /scripts | |
parent | 1bff5646e64a32b83dcf5ac5acf4e31b98382aae (diff) | |
download | tor-b3b737b8750b2063c5be260287088defbfadd1b9.tar.gz tor-b3b737b8750b2063c5be260287088defbfadd1b9.zip |
Update pre-commit.git-hook for ticket 29553
- handle older source layout
- handle empty changes directories
- "set -e" so that we exit if there's a problem.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/maint/pre-commit.git-hook | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/scripts/maint/pre-commit.git-hook b/scripts/maint/pre-commit.git-hook index b4c4ce2061..65fa99f4c4 100755 --- a/scripts/maint/pre-commit.git-hook +++ b/scripts/maint/pre-commit.git-hook @@ -10,16 +10,31 @@ workdir=$(git rev-parse --show-toplevel) cd "$workdir" || exit 1 -python scripts/maint/lintChanges.py ./changes/* +set -e -perl scripts/maint/checkSpace.pl -C \ -src/lib/*/*.[ch] \ -src/core/*/*.[ch] \ -src/feature/*/*.[ch] \ -src/app/*/*.[ch] \ -src/test/*.[ch] \ -src/test/*/*.[ch] \ -src/tools/*.[ch] +if [ ! -z "ls ./changes/*" ]; then + python scripts/maint/lintChanges.py ./changes/* +fi + +if [ -d src/lib ]; then + # This is the layout in 0.3.5 + perl scripts/maint/checkSpace.pl -C \ + src/lib/*/*.[ch] \ + src/core/*/*.[ch] \ + src/feature/*/*.[ch] \ + src/app/*/*.[ch] \ + src/test/*.[ch] \ + src/test/*/*.[ch] \ + src/tools/*.[ch] +elif [ -d src/common]; then + # This was the layout before 0.3.5 + perl scripts/maint/checkSpace.pl -C \ + src/common/*/*.[ch] \ + src/or/*/*.[ch] \ + src/test/*.[ch] \ + src/test/*/*.[ch] \ + src/tools/*.[ch] +fi if test -e scripts/maint/checkIncludes.py; then python scripts/maint/checkIncludes.py |