Skip to content

Commit

Permalink
feat(config): make the git section optional (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Jan 16, 2022
1 parent 3b3ef7e commit 8202e37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion git-cliff-core/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Commit<'_> {
/// * extacts links and generates URLs
pub fn process(&self, config: &GitConfig) -> Result<Self> {
let mut commit = self.clone();
if config.conventional_commits {
if config.conventional_commits.unwrap_or(true) {
if config.filter_unconventional.unwrap_or(true) {
commit = commit.into_conventional()?;
} else if let Ok(conv_commit) = commit.clone().into_conventional() {
Expand Down
7 changes: 5 additions & 2 deletions git-cliff-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub struct Config {
/// Configuration values about changelog generation.
pub changelog: ChangelogConfig,
/// Configuration values about git.
#[serde(default)]
pub git: GitConfig,
}

Expand All @@ -24,10 +25,12 @@ pub struct ChangelogConfig {
}

/// Git configuration
#[derive(Debug, Clone, serde_derive::Serialize, serde_derive::Deserialize)]
#[derive(
Debug, Default, Clone, serde_derive::Serialize, serde_derive::Deserialize,
)]
pub struct GitConfig {
/// Whether to enable parsing conventional commits.
pub conventional_commits: bool,
pub conventional_commits: Option<bool>,
/// Whether to filter out unconventional commits.
pub filter_unconventional: Option<bool>,
/// Git commit parsers.
Expand Down

0 comments on commit 8202e37

Please sign in to comment.