Skip to content

fix(bump): use commit subject for non-conventional bumps#1478

Open
jagath-sajjan wants to merge 1 commit intoorhun:mainfrom
jagath-sajjan:main
Open

fix(bump): use commit subject for non-conventional bumps#1478
jagath-sajjan wants to merge 1 commit intoorhun:mainfrom
jagath-sajjan:main

Conversation

@jagath-sajjan
Copy link
Copy Markdown

@jagath-sajjan jagath-sajjan commented Apr 8, 2026

Description

Fixes version bump detection for multiline custom commits when conventional_commits = false.

Previously, git-cliff passed the full non-conventional commit message into version bump detection. When a multiline commit was provided via --with-commit, custom_major_increment_regex and custom_minor_increment_regex could be ignored, causing an incorrect patch bump.

This change makes nonconventional commits use only the subject line (the first line) for bump calculation, while preserving the full message for changelog generation. It also adds regression tests covering multiline major and minor bump cases.

Motivation and Context

Fixes #1476.

This is needed for users who disable conventional commits and rely on custom prefixes like breaking or feat at the start of free-form commit subjects. With this fix, multiline --with-commit input behaves consistently with single-line input for version bumping.

How Has This Been Tested?

Added regression coverage in git-cliff-core/src/release.rs for:

  • Multiline non-conventional commits matching custom_major_increment_regex
  • Multiline non-conventional commits matching custom_minor_increment_regex

Commands run:

  • cargo fmt --all
  • cargo test -p git-cliff-core release::test::bump_version -- --nocapture

Notes:

  • The targeted regression test passed.
  • cargo test -p git-cliff-core still showed existing unrelated failures in repo::test::{get_latest_tag, git_tags, resolves_existing_tag_with_name_and_message} in my local environment.

Screenshots / Logs (if applicable)

N/A

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly (if applicable).
  • I have formatted the code with rustfmt.
    • cargo +nightly fmt --all
  • I checked the lints with clippy.
    • cargo clippy --tests --verbose -- -D warnings
  • I have added tests to cover my changes.
  • All new and existing tests passed.
    • cargo test

@jagath-sajjan jagath-sajjan requested a review from orhun as a code owner April 8, 2026 04:25
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.69%. Comparing base (39cd76e) to head (47ab8c7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1478      +/-   ##
==========================================
+ Coverage   47.35%   47.69%   +0.34%     
==========================================
  Files          24       24              
  Lines        2131     2135       +4     
==========================================
+ Hits         1009     1018       +9     
+ Misses       1122     1117       -5     
Flag Coverage Δ
unit-tests 47.69% <100.00%> (+0.34%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

custom_major/minor_increment_regex ignored for multiline commits when conventional_commits = false

2 participants