Skip to content

Keep #-leading lines in an annotated tag message [patch] - #209

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/170-tag-message-cleanup
Oct 13, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/170-tag-message-cleanup

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #170

What was wrong

Unlike git commit, git tag applies --cleanup=strip even to a --message value, so it drops every line that starts with # as a comment. CreateTag(...).Annotating("#123 fixed the crash") therefore created a tag with an empty message, and git still exited 0.

Change

  • When a message is set, GitTagCreateBuilder now emits --cleanup=whitespace, the same pin GitCommitBuilder already uses. Lightweight tags are unchanged.
  • Argument-vector tests: the flag is present, and before --end-of-options, for an annotated tag, and absent for a lightweight tag.
  • Integration test: the message "#123 fixed the crash\n\n# 456 another" round-trips. Tags() reports the subject, and git cat-file -p shows the body line kept.

Verification

  • Both new message tests fail with the builder change reverted and pass with it.
  • Full suite: dotnet test passed 803 of 803.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KLFPeLz9EhDwj3AmatpfG6


Generated by Claude Code

git tag applies strip cleanup even to a --message value, so every line
starting with # was dropped as a comment: "#123 fixed the crash" left an
empty tag message while git exited 0. The tag builder now passes
--cleanup=whitespace with a message, matching GitCommitBuilder.

Fixes #170

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

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit f589ce3 into main Oct 13, 2026
16 checks passed
@matt-edmondson
matt-edmondson deleted the fix/170-tag-message-cleanup branch October 13, 2026 08:16
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.

CreateTag().Annotating(msg) silently drops lines starting with '#' from the tag message (git tag defaults to --cleanup=strip)

2 participants