Skip to content

pre-commit hook for commitizen-branch broken since 4.15.1 #2003

@Thomas-Neumann

Description

@Thomas-Neumann

Description

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>...]'
default_install_hook_types:
  - pre-commit
  - pre-push

repos:
  - repo: https://github.com/commitizen-tools/commitizen
    rev: v4.15.0
    hooks:
      - id: commitizen-branch
        stages:
          - pre-push
          - 

Steps to reproduce

  1. Create branch and make a dummy change
  2. Use above configuration
    1. git add && git commit (works)
    2. git push (works)
  3. Create a new commit, update to any newer version (4.15.1 / 4.16.0 / 4.16.1 / 4.16.2)
    1. git add && git commit (works)
    2. 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

Image

Environment

No output for cz version --report since I don't have cz installed.
Commitizen is managed by the pre-commit hook.

pre-commit version in case it's relevant: 4.6.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions