Skip to content

Commit

Permalink
fix: Allow --bump from 20.0.1 to 20.1
Browse files Browse the repository at this point in the history
It's weird so we still warn, but returning `None` from
`check_semver_bump` only makes sense if the versions are deemed to be
the same. Otherwise it's just confusion for the user — the UI presents
this as an upgrade, proceeds to uninstall the old version, but fails to
do the actual bump and no new version is installed.
  • Loading branch information
liskin authored and jdx committed Nov 27, 2024
1 parent 441100d commit c973604
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/toolset/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,11 +758,10 @@ fn check_semver_bump(old: &str, new: &str) -> Option<String> {
if !old_chunks.is_empty() && !new_chunks.is_empty() {
if old_chunks.len() > new_chunks.len() {
warn!(
"something weird happened with versioning, old: {old:?}, new: {new:?}, skipping",
"something weird happened with versioning, old: {old:?}, new: {new:?}",
old = old_chunks,
new = new_chunks,
);
return None;
}
let bump = new_chunks
.into_iter()
Expand Down Expand Up @@ -916,6 +915,10 @@ mod tests {
check_semver_bump("20.0.0", "20.0.1"),
Some("20.0.1".to_string())
);
std::assert_eq!(
check_semver_bump("20.0.1", "20.1"),
Some("20.1".to_string())
);
std::assert_eq!(
check_semver_bump("2024-09-16", "2024-10-21"),
Some("2024-10-21".to_string())
Expand Down

0 comments on commit c973604

Please sign in to comment.