Open wookayin opened 6 months ago
Hello, thanks for reporting this!
This is because the commit in question is not conventional and it is not filtered out. That is why git-cliff
uses that commit in the changelog as-is.
To skip those commits:
filter_unconventional = true
Or if you only want the first line to appear in the changelog:
- <<< {{ commit.id }} >>> {{ commit.message | split(pat="\n") | first | upper_first | trim }}
You can also use commit preprocessors/postprocessors to process the commit/changelog.
When it comes to the actual question, I agree that we should normalize CR, LF into LF. That can be also done with pre-processors though. I'm not sure if git-cliff
should manipulate the commit message internally in this case.
Q: Is the regex ^foo
matched against each of the lines or against the very first few characters only? How is the multiline string (or '\n') handled on regex matching? I thought it should be latter, but I don't still understand why this multiline string appears. Other commits also have a body that follow the title, but they won't appear. What makes the difference?
Q: Is the regex ^foo matched against each of the lines or against the very first few characters only?
It is matched for the first line since it is not configured as multi line. I also think that it should support multiline but I'm not sure how to achieve that with serde_regex
:
/// Regex for matching the commit message.
#[serde(with = "serde_regex", default)]
pub message: Option<Regex>,
Feel free to open a tracking issue about this!
Other commits also have a body that follow the title, but they won't appear. What makes the difference?
feat(lsp): inlay hints #23984
is a conventional commit so only the "Inlay hints #23984" parts makes it into the changelog. You can use commit.body
to access the rest of the commit message.docs #24061.......
is not conventional so the entirety of the commit appears in the changelog.I hope this answers your question 🐻
Describe the bug
I think only the title of git commit messages should be considered, but when the commit contains mixed CR/LF for some reason, extraction of commit title would be broken, resulting into multi-line messages (with CR) printed in the release note.
To reproduce
c.toml:
Output:
A strange commit 72a6643b1380cdf6f1153d70eeaffb90bdca30d6 has a commit message where CR and LF is mixed.
Expected behavior
Only the first line is considered. Maybe we should normalize CR, LF into LF.
Screenshots / Logs
N/A
Software information
Additional context
This repro is a simplification of https://github.com/neovim/neovim/pull/26818 where
git cliff --config scripts/cliff.toml v0.9.0..HEAD
produces some strange multi-line release note items.