Skip to content

Commit

Permalink
fix(version)!: prioritize --major --minor --patch over --bump
Browse files Browse the repository at this point in the history
If the version was 0.2.3, we expect `convco version --bump --major` to return 1.0.0 instead of 0.2.4.

BREAKING CHANGE: changes behaviour if `--bump` is used in combination with `--major`, `--minor` or `--patch`
  • Loading branch information
hdevalke committed Aug 17, 2020
1 parent 01c9ea9 commit 8c728a8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/cmd/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,7 @@ impl VersionCommand {
impl Command for VersionCommand {
fn exec(&self) -> Result<(), Error> {
if let Some(VersionAndTag { tag, mut version }) = self.find_last_version()? {
let v = if self.bump {
if version.is_prerelease() {
version.pre.clear();
version.build.clear();
(version, Label::Release)
} else {
self.find_bump_version(tag.as_str(), version)?
}
} else if self.major {
let v = if self.major {
version.increment_major();
(version, Label::Major)
} else if self.minor {
Expand All @@ -124,6 +116,14 @@ impl Command for VersionCommand {
} else if self.patch {
version.increment_patch();
(version, Label::Patch)
} else if self.bump {
if version.is_prerelease() {
version.pre.clear();
version.build.clear();
(version, Label::Release)
} else {
self.find_bump_version(tag.as_str(), version)?
}
} else {
(version, Label::Release)
};
Expand Down

0 comments on commit 8c728a8

Please sign in to comment.