Skip to content

Keep changelog subjects and authors intact when a commit subject contains '|' - #155

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/154-commit-subject-separator
Sep 26, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/154-commit-subject-separator

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #154

What was wrong

GitService.GetCommitsAsync asked git for %h|%s|%aN and split each line on |. A subject such as Support a|b syntax was parsed as subject Support a with author b syntax. That corrupted the CHANGELOG, the NuGet release notes and the GitHub release body. It also made ChangelogGenerator.IsBotCommit misjudge the commit in both directions.

Change

  • The format is now %h%x1f%s%x1f%aN, and lines are split on '\u001f', the ASCII unit separator. That character cannot appear in a subject or an author name.
  • The two existing parse tests now use the new separator in their mocked output.
  • Added GetCommitsAsync_PipeInSubject_KeepsSubjectAndAuthorIntact and GetCommitsAsync_AsksGitForUnitSeparatedFields.

Verification

  • dotnet test: 743 passed, 0 failed.
  • With the GitService.cs change reverted, 4 GitServiceTests fail, including the new pipe-in-subject test.
  • I also ran real git: git log -1 --pretty=format:"%h%x1f%s%x1f%aN" emits byte 0x1F between the fields.

🤖 Generated with Claude Code

https://claude.ai/code/session_01T3Dc4pH8DW9RqEzV5znBXQ


Generated by Claude Code

…ains '|'

GetCommitsAsync asked git for "%h|%s|%aN" and split on '|', so a subject such as
"Support a|b syntax" became the subject "Support a" with the author "b syntax".
That corrupted the changelog, the NuGet release notes and the GitHub release
body, and made the bot-commit filter misjudge the commit.

Separate the fields with the ASCII unit separator (%x1f), which cannot appear
in a subject or an author name.

Fixes #154

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T3Dc4pH8DW9RqEzV5znBXQ
@sonarqubecloud

Copy link
Copy Markdown

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.

A | in a commit subject truncates its changelog entry and sets the author to the rest of the subject

2 participants