Skip to content

fix patch bump pre release#93

Open
MarkOSullivan94 wants to merge 1 commit into
f3ath:masterfrom
MarkOSullivan94:fix-bump-patch-pre-release
Open

fix patch bump pre release#93
MarkOSullivan94 wants to merge 1 commit into
f3ath:masterfrom
MarkOSullivan94:fix-bump-patch-pre-release

Conversation

@MarkOSullivan94

@MarkOSullivan94 MarkOSullivan94 commented Jun 16, 2026

Copy link
Copy Markdown

Resolves #92

This pull request addresses an issue with version bumping when using the --pre flag on a pre-release version. Previously, bumping a patch with the same pre-release identifier could result in no version change (e.g., 0.0.16-beta0.0.16-beta). The logic now ensures the numeric component is incremented as expected. A new test case was also added to verify this behavior.

Version bumping logic improvements:

  • Updated the version bumping algorithm in Project to retry the bump against the stripped release version if the next version does not advance due to the --pre flag and the current version is already a pre-release. This ensures the numeric component is incremented (e.g., 0.0.16-beta0.0.17-beta).

Testing enhancements:

  • Added a functional test to verify that bumping a patch with --pre=beta from a pre-release correctly increments the patch number and applies the pre-release suffix (e.g., 0.0.16-beta0.0.17-beta).

Comment thread test/functional_test.dart
expect(err.buffer.toString().trim(),
'The next version must be higher than the current one.');
});
test('bump patch --pre=beta from pre-release bumps patch number', () async {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be reproduced by adding the line

        ['bump', 'patch', '--pre=alpha']: '0.0.6-alpha',

to the test above

Comment thread lib/src/project.dart
@@ -50,7 +50,17 @@ class Project {
mutation = m.Sequence([mutation, m.SetPreRelease(pre)]);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a cleaner solution would be to strip the pre-release here, like

      mutation = m.Sequence([m.StripPreRelease(), mutation, m.SetPreRelease(pre)]);

but since we don't have StripPreRelease yet, this should work too.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cider bump patch --pre=beta errors for version 0.0.16-beta but it should should bump to 0.0.17-beta

2 participants