xtask: Fix release creating an empty commit on existing release
@@ -108,6 +108,7 @@ impl ReleaseTask {
let mut macros = self.macros();
+ if self.package.version != self.version {
if let Some(m) = macros.as_mut() {
println!("Found macros crate {}.", m.name);
@@ -119,10 +120,18 @@ impl ReleaseTask {
self.package.update_version(&self.version)?;
self.package.update_dependants(&self.metadata)?;
+ }
let changes = &self.package.changes(!prerelease)?;
+ if self.package.version != self.version {
self.commit()?;
+ } else if !ask_yes_no(&format!(
+ "Package is already version {}. Skip creating a commit and continue?",
+ &self.version
+ ))? {
+ return Ok(());
+ }
if let Some(m) = macros {
let published = m.publish(&self.http_client)?;
