Skip to content

Honor Git cleanup rules for comment-prefixed commit messages - #929

Merged
sds merged 3 commits into
mainfrom
fix-736-commit-message-comments
Nov 10, 2026
Merged

sds merged 3 commits into
mainfrom
fix-736-commit-message-comments

Conversation

@sds

@sds sds commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Commit-message hooks always removed comment-prefixed lines, causing git commit -m '#16: ...' to fail EmptyMessage even when Git would preserve the title. Honor Git's effective cleanup mode when filtering comments, so hooks see those titles while messages that become empty under stripping cleanup are still rejected.

Closes #736.

Resolve command-line --cleanup overrides before commit.cleanup, and use Git's documented GIT_EDITOR=: marker for the editor-dependent default. Cache that result within the commit-message context. On Windows, follow the env.exe launcher to the invoking Git process in the COM, Script Host, and PowerShell query paths, so command-line overrides are visible. Alternate comment characters and existing verbose-diff filtering continue to work.

Adds unit and installed-hook integration tests for the scenarios in #736: default -m, alternate comment characters, configured and explicit whitespace cleanup, quoted Windows options, overrides before/after the message, verbatim cleanup, editor-based commits, and empty-message rejection. Integration tests check the final message stored by Git.

Validation: all 1,844 local RSpec examples pass; pre-commit checks and RuboCop pass. GitHub CI will verify Ruby 3.3/3.4/4.0 on Ubuntu and Windows.

References: Git commit cleanup modes, Git hook editor marker.

@sds
sds merged commit 7df0e1b into main Nov 10, 2026
20 checks passed
@sds
sds deleted the fix-736-commit-message-comments branch November 10, 2026 06:58
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.

Problems with commit message titles start with #

1 participant