Skip to content

^ in commit_parsers with split_commits not working #1093

@erikthi

Description

@erikthi

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

I am trying to generate a changelog for unconventional commits. The commits may potentially contain more than one change, and I would like to use the commit parsers to grab each relevant part and make a separate entry for them in the changelog.

Steps To Reproduce

Configuration like this

{% else %}\
    ## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
    ### {{ group | striptags | trim | upper_first }}
    {% for commit in commits %}
        - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
            {% if commit.breaking %}[**breaking**] {% endif %}\
            {{ commit.message | upper_first }}\
    {% endfor %}
{% endfor %}\n
"""

footer = """
<!-- generated by git-cliff -->
"""
# remove the leading and trailing s
trim = true

[git]
conventional_commits = false
filter_unconventional = false
split_commits = true
commit_parsers = [
  { message = "^fix:", group = "Fixed" },
]
filter_commits = true
topo_order = false
sort_commits = "oldest"


cd $(mktemp -d)
git init .
git commit --allow-empty -m "Unconventional commit" -m "fix: first line of the commit body"
git cliff

This yields an empty changelog.

Expected behavior

I would the changelog to contain:

Fixed

  • Fix: first line of the commit body

This is also what happens if I change

commit_parsers = [
  { message = "^fix:", group = "Fixed" },
]

to

commit_parsers = [
  { message = "fix:", group = "Fixed" },
]

Screenshots / Logs

No response

Software information

  • Operating system: Mac OS 14.6.1
  • Rust version: 1.85.0
  • Project version: Tested on both 2.5.0 and 2.8.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions