Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't bump without using annotated_tag #879

Open
CharlesAracil opened this issue Oct 5, 2023 · 1 comment
Open

Can't bump without using annotated_tag #879

CharlesAracil opened this issue Oct 5, 2023 · 1 comment

Comments

@CharlesAracil
Copy link

CharlesAracil commented Oct 5, 2023

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

@Lee-W
Copy link
Member

Lee-W commented May 20, 2024

Hi @CharlesAracil , sorry for the late reply. I just tested it without encountering the issue. I also noticed the code you mentioned hasn't been touched. I suspect his might be due to some git setting. Do you change tag-related git settings? I also have my git editor set up this way but does not have editor opened when running git tag 0.2.0.

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

No branches or pull requests

2 participants