Skip to content

[BUG] Bump failes if Changelog exists #357

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

Closed
nbrugger-tgm opened this issue Feb 27, 2021 · 8 comments · Fixed by #390
Closed

[BUG] Bump failes if Changelog exists #357

nbrugger-tgm opened this issue Feb 27, 2021 · 8 comments · Fixed by #390

Comments

@nbrugger-tgm
Copy link

nbrugger-tgm commented Feb 27, 2021

Description

When i run cz bump it fails unless i delete the CHANGELOG.md generated by the last bump. While the version is bumped and all files are changed in regard to the version in there, the commit and tag isn't created

Steps to reproduce

  1. clone https://github.com/FactoryRally/game-controller
  2. checkout commit 45d5049d69ee6c0d3a5b879caa619d1cab58f575
  3. run cz bump
  4. delete CHANGELOG.md
  5. run cz bump again

Current behavior

nitonfx@laptop:/path/game-controller$ cz bump
bump: version 2.2.0b0 → 2.2.0
tag to create: v2.2.0
increment detected: MINOR

No tag found to do an incremental changelog
nitonfx@laptop:/path/game-controller$ rm CHANGELOG.md
nitonfx@laptop:/path/game-controller$ cz bump
bump: version 2.2.0b0 → 2.2.0
tag to create: v2.2.0
increment detected: MINOR

Done!

Desired behavior

A clearer message whats going wrong or it just working.

Environment

  • commitizen version: 2.13.0
  • python version: 2.7.17
  • operating system: Linux
@woile
Copy link
Member

woile commented Feb 28, 2021

Hey, thanks for reporting. I tried reproducing your behavior but I couldn't.

I've used cz versions >2.14

The changelog is generated without problems, did you solve it already?

One potential solution could be to remove the changelog, recrate using it cz changelog and then use cz bump.

I'm gonna try adding a more descriptive error message soon.

@nbrugger-tgm
Copy link
Author

using cz changelog and then cz bump generates the same issue.

Original Bug : https://asciinema.org/a/9yoGmfQPUFTKhzPACwvQAFgkK

Using cz changelog : https://asciinema.org/a/vuluQJWXdgP1uDz4ffdkVYgd1

@woile
Copy link
Member

woile commented Mar 1, 2021

Sorry it's not clear to me. What should I look for in those recordings? From what I gather it's working as expected, maybe I'm missing some detail. Both seems fine to me 🤔

@nbrugger-tgm
Copy link
Author

nbrugger-tgm commented Mar 1, 2021

The behavior changes when deleting the CHANGELOG from not finding a commit, to working.
. Which i cant really relate because i just did rm CHNAGELOG.md and didnt commited anything new.

(the message was fatal: tag already exists because it does. But everything else was done correctly eg. creating bump commit, incrementing changelog etc. So i consider it working -> showing expected behaviour)

The second recording includes applying your fix idea of using cz changelog before cz bump

I will try to create a reproduceable "bugged" environment for you to play arround with if you can wait a few days

@woile
Copy link
Member

woile commented Mar 1, 2021

Yes, but removing the CHANGELOG creates a git change:

deleted: CHANGELOG.md

bump will include staged and not staged changes, and it will create a commit. So if you inspect that "bump" commit, it will include the removal of the CHANGELOG

@nbrugger-tgm
Copy link
Author

Not really it "regenerated" the CHANGELOG (see : git-kraken commit screenshot). Which is favorable. And as you can see in the additions to the Changelog there are indeed commits which it cant find if the Changelog exists.

But i understand that this is not directly correlated to this GH issue so i will try to create a reproduceable environment to enable you to see the behaviour of the root issue

@phildong
Copy link

I believe I'm seeing very similar behavior, and I believe this only happens when the last version is a pre-release.
Here is a reproducible example I'm able to come up with:

# step1 init everything, not exactly relevant to the bug
git init
cz init
git add .
git commit -m "chore: add config"
git tag 0.0.1

# step2 add a dummy feature and make a pre-release
git commit -m "feat: first feat" --allow-empty
cz bump --prerelease rc --changelog

# step3 add another feature and try to do incremental changelog
git commit -m "feat: second feat" --allow-empty
cz changelog --incremental

The last line would fail with No tag found to do an incremental changelog
As @nbrugger-tgm noted clearing the content of changelog would work around this, but of course that would clear any custom edits in the changelog.
However everything would be fine if I don't do --prerelease in step2.

I'm using git version 2.31.1 and cz version 2.17.4

Let me know if this is reproducible/helpful!

@Lee-W
Copy link
Member

Lee-W commented May 1, 2021

Hi @phildong , thanks for reporting. I just confirm it's reproducible on my machine.

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

Successfully merging a pull request may close this issue.

4 participants