Skip to content

Commit 9c6eec2

Browse files
committed
fix(bump): fixed environment variables in bump hooks
During development of commitizen-tools#644, merging the hook environment variables with existing OS variables broke. This commit fixes that.
1 parent 1ff575d commit 9c6eec2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

commitizen/hooks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from commitizen import cmd, out
44
from commitizen.exceptions import RunHookError
55

6+
import os
7+
68

79
def run(hooks, _env_prefix="CZ_", **env):
810
if isinstance(hooks, str):
@@ -25,7 +27,7 @@ def run(hooks, _env_prefix="CZ_", **env):
2527
def _format_env(prefix: str, env: dict[str, str]) -> dict[str, str]:
2628
"""_format_env() prefixes all given environment variables with the given
2729
prefix so it can be passed directly to cmd.run()."""
28-
penv = dict()
30+
penv = os.environ
2931
for name, value in env.items():
3032
name = prefix + name.upper()
3133
value = str(value) if value is not None else ""

0 commit comments

Comments
 (0)