commitizen: cz check range sometimes failed in GitLab CI
Description
Runcz check --range origin/master..HEAD to check commits in CI occasionally fails.
And it worked after I retried the job.But sometimes it didn’t work after retrying multiple times.
I couldn’t find out the reason ,
Steps to reproduce
lint: retry: 1 script: - cz version - cz check --rev-range origin/master…HEAD
Current behavior
cz check --rev-range origin/master..HEAD failed. Outputs attached below:
fatal: ambiguous argument 'master..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Desired behavior
cz check --rev-range can run successfully in gitlab CI.
Screenshots

Environment
commitizen version: 2.34.0 python version: 3.7.5 operating system: Linux
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 24 (7 by maintainers)
Commits related to this issue
- build(vcs): Workaround commitizen push hook bug https://github.com/commitizen-tools/commitizen/issues/593 — committed to rpatterson/project-structure by rpatterson a year ago
Hello, if I run
cz check --rev-range origin/main..HEADit works. I noticed that the pre-commit hook has--rev-range origin/HEAD..HEADwhich is an invalid ref. Perhaps when the repo has multiple branches the reference becomes invalid? Will try to make a reprex soon.The following fixed it for me:
Eventually found a semi-good explanation at: https://learnku.com/articles/71493
(My issue is actually when I’m trying to run
git pushwith the pre-push hook enabled, which then gives a similar error on ambiguity.)Oh,it didn’t show anything of
git log origin/master. Maybe there’s nogit fetchon some CI machines. I trygit fetch originand it works. Thanks for your help!