From 75e1fb0ddfd280e3f0869889fb87c2fbde395ef3 Mon Sep 17 00:00:00 2001 From: Guillaume Lambert Date: Wed, 26 May 2021 20:56:25 +0200 Subject: [PATCH] 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 --- tox.ini | 1 + 1 file changed, 1 insertion(+) 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 -- 2.16.6