You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pre-commit hook for commitizen-branch broken since 4.15.1 #2003
I can't upgrade my pre-commit hooks from 4.15.0 to 4.15.1 since it would break commitizen-branch.
The error message is:
commitizen check branch..................................................Failed
- hook id: commitizen-branch
- exit code: 23
fatal: ambiguous argument '$PRE_COMMIT_FROM_REF..$PRE_COMMIT_TO_REF': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Create a new commit, update to any newer version (4.15.1 / 4.16.0 / 4.16.1 / 4.16.2)
git add && git commit (works)
git push (fails)
Current behavior
Any version newer than 4.15.0 fails with an error.
Configuration:
repos:
- repo: https://github.com/commitizen-tools/commitizen
# can be any of: 4.15.1, 4.16.0, 4.16.1, 4.16.2
rev: v4.15.1
hooks:
- id: commitizen-branch
stages:
- pre-push
Error:
commitizen check branch..................................................Failed
- hook id: commitizen-branch
- exit code: 23
fatal: ambiguous argument '$PRE_COMMIT_FROM_REF..$PRE_COMMIT_TO_REF': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Desired behavior
I can update commitizen-branch to use the most recent version (4.16.2).
Screenshots
Environment
No output for cz version --report since I don't have cz installed.
Commitizen is managed by the pre-commit hook.
I think this was introduced by #1941. Commitizen no longer runs the Git command through shell=True, so the environment variable placeholders in the rev range are not expanded by a shell anymore.
Opened #2005 with the fix and a regression test that reproduces the exact atal: ambiguous argument error from this issue when the fix is reverted. Thanks again @j178 for the root-cause analysis.
Activity
j178 commentedon May 29, 2026
I think this was introduced by #1941. Commitizen no longer runs the Git command through
shell=True, so the environment variable placeholders in the rev range are not expanded by a shell anymore.bearomorphism commentedon May 30, 2026
@j178 Thanks for your RCA. Let me take a look.
bearomorphism commentedon May 30, 2026
Opened #2005 with the fix and a regression test that reproduces the exact atal: ambiguous argument error from this issue when the fix is reverted. Thanks again @j178 for the root-cause analysis.
fix(check): expand env vars in --rev-range (commitizen-tools#2005)
Thomas-Neumann commentedon Jun 1, 2026
Thank you so much for fixing this bug.
I can confirm that 4.16.3 fixes the reported issue.
bearomorphism commentedon Jun 2, 2026
Thank you!
stelewis commentedon Jun 7, 2026
Thanks for fixing this! Much appreciated.