Skip to content

Commit

Permalink
fix(changelog): drop the skipped releases from 'previous' field
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Dec 8, 2021
1 parent d7e8ce2 commit 7f867ae
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions git-cliff/src/changelog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,20 @@ impl<'a> Changelog<'a> {
}
})
.collect();
if skip_regex.is_some() {
let mut releases = self.releases.clone();
for (i, release) in self.releases.iter_mut().enumerate() {
if release.previous.is_none() {
continue;
}
if let Some(previous_release) = releases.get_mut(i + 1) {
previous_release.previous = None;
release.previous = Some(Box::new(previous_release.clone()));
} else {
release.previous = None;
}
}
}
}

/// Generates the changelog and writes it to the given output.
Expand Down

0 comments on commit 7f867ae

Please sign in to comment.