Skip to content

Incorrect next version detection when working with multiple branches #1089

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

Open
1 task done
entermix opened this issue Mar 12, 2025 · 3 comments
Open
1 task done

Incorrect next version detection when working with multiple branches #1089

entermix opened this issue Mar 12, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@entermix
Copy link

entermix commented Mar 12, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

Hi!

Thanks for this great project!

I recently ran into a issue with multiple branches. I'll try to keep the workflow as simple as possible below.

I have a main branch, but before creating a release I created a branch 1.0 and added a tag v1.0.0, then in the same branch I added a tag v1.0.1 - the changelog is built correctly, but after I merged all the changes into the main branch to prepare the 1.1 branch - the process is broken.

git-cliff cannot correctly determine the next version with the command git-cliff --bumped-version

Steps To Reproduce

To make the process as simple as possible I did not use a configuration file, however I had previously tried various methods to achieve correct operation, but I did not succeed

git init --initial-branch=main
echo "main" > test.txt
git add "test.txt"
git commit -m "chore: initial commit"
git checkout -b "1.0"
echo "1.0.0" > test.txt
git add "test.txt"
git commit -m "chore: release v1.0.0"

git-cliff --bumped-version
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
 WARN  git_cliff_core::config > No releases found, using 0.1.0 as the next version.
0.1.0

git tag v1.0.0

git-cliff --bumped-version
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
 WARN  git_cliff > There is nothing to bump.
v1.0.0
echo "1.0.1" > test.txt
git add "test.txt"
git commit -m "chore: release v1.0.1"

git-cliff --bumped-version
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
v1.0.1

git tag v1.0.1

git-cliff --bumped-version
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
 WARN  git_cliff > There is nothing to bump.
v1.0.1
git checkout main

echo "some changes" > test.txt
git add "test.txt"
git commit -m "chore: test"

git-cliff --bumped-version
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
v1.0.2 <<<-----

git merge 1.0

git log --oneline
4a61d4e (HEAD -> main, 1.1) Merge branch '1.0'
e877f38 chore: test
e5ffe3b (tag: v1.0.1, 1.0) chore: release v1.0.1
dbfba27 (tag: v1.0.0) chore: release v1.0.0
2034462 chore: initial commit

git tag --list
v1.0.0
v1.0.1

git-cliff --bumped-version
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
 WARN  git_cliff > There is nothing to bump.
v1.0.1 <<<-----
git checkout -b 1.1

git log --oneline
4a61d4e (HEAD -> 1.1, main) Merge branch '1.0'
e877f38 chore: test
e5ffe3b (tag: v1.0.1, 1.0) chore: release v1.0.1
dbfba27 (tag: v1.0.0) chore: release v1.0.0
2034462 chore: initial commit

git tag --list
v1.0.0
v1.0.1

git-cliff --bumped-version
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
 WARN  git_cliff > There is nothing to bump.
v1.0.1 <<<-----

Expected behavior

The correct next version should be 1.0.2, not 1.0.1

git-cliff --bumped-version
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
 WARN  git_cliff > There is nothing to bump.
v1.0.2 <<<-----

Screenshots / Logs

No response

Software information

  • Operating system: Windows
  • Rust version: -
  • Project version: 2.8.0

Additional context

No response

@entermix entermix added the bug Something isn't working label Mar 12, 2025
Copy link

welcome bot commented Mar 12, 2025

Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️

@orhun
Copy link
Owner

orhun commented Mar 23, 2025

Thanks for reporting! The bump mechanism was designed with a single branch in mind so there might be some edge cases when working with multiple branches.

Maybe try out with --topo-order flag for ordering the tags.

I can try to reproduce the problem soon.

P.S. There is a related issue here: #1080

@orhun orhun removed their assignment Mar 23, 2025
@entermix
Copy link
Author

entermix commented Mar 23, 2025

@orhun, thanks!

I tried running the command with the --topo-order flag, however nothing changed. The problem seems to be something else

Note that the branch in which the command is run contains all necessary commits and tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants