Skip to content

chore: normalize commit messages#194

Draft
gregggreg wants to merge 5 commits into
marcus:docs-backfillfrom
gregggreg:commit-normalize
Draft

chore: normalize commit messages#194
gregggreg wants to merge 5 commits into
marcus:docs-backfillfrom
gregggreg:commit-normalize

Conversation

@gregggreg

@gregggreg gregggreg commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • normalize and validate Conventional Commit subjects in place
  • preserve message bodies, trailers, and recognized Git-generated workflow messages
  • reject arbitrary comment-prefixed manual subjects while honoring configured Git comment prefixes for combined commits
  • enable repository-managed pre-commit and commit-msg hooks without replacing an existing local hooks path
  • document the accepted format and add portable, caller-independent shell regression coverage

Format

Supported subjects use type(scope)!: summary, with optional scope and breaking-change marker. Supported types are build, chore, ci, docs, feat, fix, perf, refactor, style, and test.

The normalizer lowercases supported types, normalizes separator spacing, collapses repeated subject whitespace, trims surrounding blank lines, and removes trailing whitespace. Merge, revert, autosquash, stash, and recognized combined-commit messages are preserved byte for byte. Malformed or ambiguous subjects are rejected without changing the message file.

The installer writes only repository-local configuration. It is idempotent for .githooks and fails without changing configuration when another local core.hooksPath is already set.

Iteration 3 fix

The regression runner previously inherited caller Git configuration. A global core.commentString=// therefore caused the default # combined-commit fixture to fail even though that setting is supported by the normalizer. The runner now disables system configuration, points global configuration at an isolated test file, and establishes a deterministic command-scope default. Explicit custom-prefix tests still override that baseline.

Validation

  • make test with caller global core.commentString=// (all Go tests and 29 normalizer regressions)
  • normalizer regressions under both sh and dash, including inherited command-scope Git configuration
  • go vet ./...
  • go build ./...
  • sh -n and dash -n for all hook-related shell files
  • end-to-end commit hook probe: normalized a valid subject and rejected an invalid subject
  • git diff --check

Stack

This targets docs-backfill because the task required branching from the original checked-out branch. It should be reviewed after #104.

Nightshift-Task: commit-normalize
Nightshift-Ref: https://github.com/marcus/nightshift
Nightshift-Task: commit-normalize
Nightshift-Ref: https://github.com/marcus/nightshift
Nightshift-Task: commit-normalize
Nightshift-Ref: https://github.com/marcus/nightshift
Nightshift-Task: commit-normalize
Nightshift-Ref: https://github.com/marcus/nightshift
Nightshift-Task: commit-normalize
Nightshift-Ref: https://github.com/marcus/nightshift
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.

1 participant