scripts: Add env variable to disable pre-commit hook

We introduce TOR_EXTRA_PRE_COMMIT_CHECKS environment variable to run the
pre-commit hook. The pre-push git hook will set it in order to run all
pre-commit checks.

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet 2020-07-02 13:47:12 -04:00
parent 064e23e95c
commit 8ae0ecbd6a
2 changed files with 6 additions and 0 deletions

View File

@ -7,6 +7,11 @@
# it fails our code formatting, changelog entry formatting, module include # it fails our code formatting, changelog entry formatting, module include
# rules, or best practices tracker. # rules, or best practices tracker.
# Run only if this environment variable is set.
if [ -z "$TOR_EXTRA_PRE_COMMIT_CHECKS" ]; then
exit 0
fi
workdir=$(git rev-parse --show-toplevel) workdir=$(git rev-parse --show-toplevel)
cd "$workdir" || exit 1 cd "$workdir" || exit 1

View File

@ -83,6 +83,7 @@ do
src/tools/*.[ch] \ src/tools/*.[ch] \
)" )"
export TOR_EXTRA_PRE_COMMIT_CHECKS=1
# We want word splitting here, because file names are space # We want word splitting here, because file names are space
# separated # separated
# shellcheck disable=SC2086 # shellcheck disable=SC2086