fix(parser): require all commit parser fields to match - #1616
Open
sisp wants to merge 1 commit into
Open
Conversation
1 task
Author
|
I think the two CI job failures are inherited from |
orhun
reviewed
Aug 29, 2026
orhun
left a comment
Owner
There was a problem hiding this comment.
Hey hey!
Thanks for the PR!
I found two issues:
- A configured
footershould fail when the commit has no conventional footer data. Currently, whenself.convisNone, this entire condition is skipped, so another matching condition such as message can still make the parser match. { sha = "abc123...", message = "^feat", skip = true }-> will no longer match commitabc123...if its message starts with "fix", because the message check executes continue'parsersbefore reaching the SHA comparison.
Can you fix these issues and add tests for them as well?
Previously, a `commit_parsers` entry with multiple fields set (e.g. `message` and `footer`) matched a commit if any one field matched, instead of requiring all of them to match. This caused commits to be grouped incorrectly when parsers combined several conditions to narrow down a match. Commit parsers with multiple fields now only match when every specified field matches.
sisp
force-pushed
the
fix/require-all-commit-parser-fields-to-match
branch
from
August 31, 2026 08:52
4d70838 to
da3f30d
Compare
Author
|
Thanks for your diligent review and feedback! 🙇 I've updated the PR, hopefully addressed your remarks. Regarding the SHA matching behavior: I've relaxed it to be a regular matcher that can be combined with other matchers like |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously, a
commit_parsersentry with multiple fields set (e.g.messageandfooter) matched a commit if any one field matched, instead of requiring all of them to match. This caused commits to be grouped incorrectly when parsers combined several conditions to narrow down a match.Commit parsers with multiple fields now only match when every specified field matches.
The fix changes
Commit::parse, so each specified matcher field (message,body,footer,field/pattern) is checked immediately and aborts the parser viacontinue 'parsersif it doesn't match, rather than collecting all fields into a list and matching if any one of them matched.Onlysharetains its original independent fast path, matching unconditionally regardless of other fields set on the same parser; that's because a commit SHA is a unique identifier.Motivation and Context
Fixes #1612.
How Has This Been Tested?
I've added a few test cases and run the test suite.
Screenshots / Logs (if applicable)
n/a
Types of Changes
Checklist:
I have updated the documentation accordingly (if applicable).cargo +nightly fmt --allcargo clippy --tests --verbose -- -D warningscargo test