Skip to content

fix: Fix default Git grep expression #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/clog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct Clog {
/// The format to output the changelog in (Defaults to Markdown)
pub out_format: ChangelogFormat,
/// The grep search pattern used to find commits we are interested in
/// (Defaults to: "^ft|^feat|^fx|^fix|^perf|^unk|BREAKING\'")
/// (Defaults to: "^ft|^feat|^fx|^fix|^perf|^unk|^breaks|BREAKING\'")
pub grep: String,
/// The format of the commit output from `git log` (Defaults to:
/// "%H%n%s%n%b%n==END==")
Expand Down Expand Up @@ -105,9 +105,7 @@ impl Default for Clog {
"{}BREAKING'",
sections
.values()
.map(|v| v
.iter()
.fold(String::new(), |acc, al| { acc + &format!("^{}|", al)[..] }))
.flatten()
.fold(String::new(), |acc, al| { acc + &format!("^{}|", al)[..] })
),
format: "%H%n%s%n%b%n==END==".to_string(),
Expand Down Expand Up @@ -916,3 +914,17 @@ impl Clog {
writer.write_changelog(self, &sm)
}
}

#[cfg(test)]
mod test {
use super::*;

#[test]
fn default_grep() {
let clog = Clog::default();
assert_eq!(
"^ft|^feat|^fx|^fix|^perf|^unk|^breaks|BREAKING\'",
clog.grep.as_str()
);
}
}