Skip to content

Commit

Permalink
fix(changelog): don't drop commits by skip_tags
Browse files Browse the repository at this point in the history
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
  • Loading branch information
Kenji Miyake committed Nov 28, 2021
1 parent 6cec37d commit 89d0bf4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
11 changes: 0 additions & 11 deletions git-cliff/src/changelog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ impl<'a> Changelog<'a> {
/// Processes the releases and filters them out based on the configuration.
fn process_releases(&mut self) {
debug!("Processing the releases...");
let skip_regex = self.config.git.skip_tags.as_ref();
self.releases = self
.releases
.clone()
Expand All @@ -87,16 +86,6 @@ impl<'a> Changelog<'a> {
trace!("Release doesn't have any commits: {}", version);
}
false
} else if let Some(version) = &release.version {
!skip_regex
.map(|r| {
let skip_tag = r.is_match(version);
if skip_tag {
trace!("Skipping release: {}", version)
}
skip_tag
})
.unwrap_or_default()
} else {
true
}
Expand Down
17 changes: 17 additions & 0 deletions git-cliff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,23 @@ pub fn run(mut args: Opt) -> Result<()> {
// Parse tags.
let mut tags = repository.tags(&config.git.tag_pattern, args.topo_order)?;

// Skip tags.
let skip_regex = config.git.skip_tags.as_ref();
tags = tags
.into_iter()
.filter(|(_, name)| {
!skip_regex
.map(|r| {
let skip_tag = r.is_match(name);
if skip_tag {
trace!("Skipping release: {}", name)
}
skip_tag
})
.unwrap_or_default()
})
.collect();

// Parse commits.
let mut commit_range = args.range;
if args.unreleased {
Expand Down

0 comments on commit 89d0bf4

Please sign in to comment.