From: Guillaume Lambert Date: Wed, 26 May 2021 18:56:25 +0000 (+0200) Subject: Fix: local calls to pre-commit tox profile X-Git-Tag: v0.7.0~2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=75e1fb0ddfd280e3f0869889fb87c2fbde395ef3;p=releng%2Fdocs-conf.git Fix: local calls to pre-commit tox profile When run locally, pre-commit tox profile resulted in the following failure: $ tox -e pre-commit [..] gitlint...........................................................Failed - hook id: gitlint - exit code: 254 An error occurred while executing \ '/usr/bin/git config --get user.name': b'' The reason behind is that tox virtualenv cannot directly access the $HOME shell variable to retrieve the local git configuration unless this variable is explicitly declared accessible via the passenv tox parameter. This is required by gitlint to retrieve the correct git configuration parameters. Signed-off-by: Guillaume Lambert Change-Id: I99197f88cf4024a5922fe62ec07610921dcf515f --- diff --git a/tox.ini b/tox.ini index a1f2e6b..9664f40 100644 --- a/tox.ini +++ b/tox.ini @@ -41,6 +41,7 @@ commands = [testenv:pre-commit] basepython = python3 deps = pre-commit +passenv = HOME commands = pre-commit run --all-files --show-diff-on-failure pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG