Skip to content

cz info does not read from info_path for non root directory #1897

@dracorp

Description

@dracorp

Description

My cz config:

[tool.commitizen]
name = "cz_customize"
[tool.commitizen.customize]
info_path = 'README_cz.md'

cz info should display the contents of the file at info_path from any directory within the repository.

Steps to reproduce

  1. Modify .cz.toml
  2. Run cz info

Current behavior

$ cd directory
$ cz info
Traceback (most recent call last):
  File "/opt/homebrew/bin/cz", line 6, in <module>
    sys.exit(main())
             ~~~~^^
  File "/opt/homebrew/Cellar/commitizen/4.13.9/libexec/lib/python3.14/site-packages/commitizen/cli.py", line 689, in main
    args.func(conf, arguments)()  # type: ignore[arg-type]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/commitizen/4.13.9/libexec/lib/python3.14/site-packages/commitizen/commands/info.py", line 13, in __call__
    out.write(self.cz.info())
              ~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/commitizen/4.13.9/libexec/lib/python3.14/site-packages/commitizen/cz/customize/customize.py", line 72, in info
    return Path(info_path).read_text(encoding=self.config.settings["encoding"])
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.14/3.14.3_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/pathlib/__init__.py", line 787, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors, newline=newline) as f:
         ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.14/3.14.3_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/pathlib/__init__.py", line 771, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'README_cz.md'

Desired behavior

cz info should display the contents of the file at info_path from any directory within the repository.

Screenshots

No response

Environment

$ cz version --report
Commitizen Version: 4.13.9
Python Version: 3.14.3 (main, Feb 3 2026, 15:32:20) [Clang 17.0.0 (clang-1700.6.3.2)]
Operating System: Darwin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions