Skip to content

Can't bump without using annotated_tag #879

Description

@CharlesAracil

Description

Description and code analysis

When running cz bump with commitizen 3.10.0 and git 2.34.1, a commit is performed, but the command hangs out indefinitely when trying to tag.

I debug the code, and it hangs in: commitizen/git.py when running cmd.run, because without settings annotated or lightweight tag, the command it tries to launch (without the _opt parameter then), results in git tag 0.2.0, which if you'd run it in a terminal, would open an editor to add a message.
This does not happen when specify lightweight or annotated message because then the message is added:

def tag(tag: str, annotated: bool = False, signed: bool = False) -> cmd.Command:
    _opt = ""
    if annotated:
        _opt = f"-a {tag} -m"
    if signed:
        _opt = f"-s {tag} -m"
    c = cmd.run(f"git tag {_opt} {tag}")
    return c

Without those options, in commitizen/cmd.py, the stderr value returned by process.communicate hangs out, and the stacktrace produce by a SIGTERM specify:

b"Vim: Warning: Output is not to a terminal\nVim: Warning: Input is not from a terminal\n\r\nerror: There was a problem with the editor '/usr/bin/vim'.\nPlease supply the message using either -m 
or -F option.\n"

The same appears with vi, if git is configured with vi (git config --global core.editor /usr/bin/vi).

Draft of solution

I did not dig any further, so maybe I'll be irrelevant here, but would it be relevant to always specify a commit message, or maybe add a -m ""

Great tool anyway!

Steps to reproduce

  1. Run cz bump, without lightweight or annotated tag setup enabled

Current behavior

When running cz bump with commitizen 3.10.0 and git 2.34.1, a commit is performed, but the command hangs out indefinitely when trying to tag.
So the command fails, and the state becomes inconsistent, because of a bump commit in git, without a tag associated with it.

Desired behavior

The tag is performed successfully during the bump.

Screenshots

No response

Environment

Commitizen Version: 3.10.0
Python Version: 3.9.7 (default, Mar 21 2023, 20:41:25)
[GCC 11.3.0]
Operating System: Linux
Git 2.34.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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