diff options
author | David Goulet <dgoulet@torproject.org> | 2020-07-02 13:47:12 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-07-02 14:39:44 -0400 |
commit | 8ae0ecbd6a74afa6227f6e6f7af8bd82afe4c447 (patch) | |
tree | 9359a72c602147f3aad0059a2648d5e2585b8e3f /scripts/git | |
parent | 064e23e95c8d0d0fb762e1cb7699c4bd4c75ecb8 (diff) | |
download | tor-8ae0ecbd6a74afa6227f6e6f7af8bd82afe4c447.tar.gz tor-8ae0ecbd6a74afa6227f6e6f7af8bd82afe4c447.zip |
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>
Diffstat (limited to 'scripts/git')
-rwxr-xr-x | scripts/git/pre-commit.git-hook | 5 | ||||
-rwxr-xr-x | scripts/git/pre-push.git-hook | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/scripts/git/pre-commit.git-hook b/scripts/git/pre-commit.git-hook index f630a242bd..33af3fdf6e 100755 --- a/scripts/git/pre-commit.git-hook +++ b/scripts/git/pre-commit.git-hook @@ -7,6 +7,11 @@ # it fails our code formatting, changelog entry formatting, module include # 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) cd "$workdir" || exit 1 diff --git a/scripts/git/pre-push.git-hook b/scripts/git/pre-push.git-hook index efa45b9860..f0a3a250ec 100755 --- a/scripts/git/pre-push.git-hook +++ b/scripts/git/pre-push.git-hook @@ -83,6 +83,7 @@ do src/tools/*.[ch] \ )" + export TOR_EXTRA_PRE_COMMIT_CHECKS=1 # We want word splitting here, because file names are space # separated # shellcheck disable=SC2086 |