Skip to content

ZIR-000: Track commit message hooks and document commit format - #355

Open
zeroecco wants to merge 1 commit into
mainfrom
feature/commit-normalize-v2
Open

zeroecco wants to merge 1 commit into
mainfrom
feature/commit-normalize-v2

Conversation

@zeroecco

Copy link
Copy Markdown

Summary

  • Add .githooks/commit-msg (mode 100755): validates ZIR-XXX: Description format; exempts Merge and Revert commits
  • Add .githooks/prepare-commit-msg (mode 100755): auto-prepends ZIR-000: when prefix is missing, skips merge/squash sources
  • Add scripts/setup-hooks.sh: one-command activation via git config core.hooksPath .githooks
  • Add CONTRIBUTING.md: documents the commit format convention and hook setup steps

Changes from previous iteration

  • Fixed dead awk variable: removed the unused -v first_line= argument from prepare-commit-msg; awk identifies the first matching line via !done without needing it passed in
  • Single canonical hook directory: only .githooks/ exists; no duplicate hooks/ directory with non-executable copies
  • Single setup script: only scripts/setup-hooks.sh using core.hooksPath; no conflicting setup-git-hooks.sh
  • No unreferenced template files

Test plan

  • Run ./scripts/setup-hooks.sh — should print confirmation, no errors
  • Commit with ZIR-123: Some change — hook accepts it
  • Commit with Some changeprepare-commit-msg prepends ZIR-000: Some change; commit-msg accepts the normalized form
  • Commit with Bad message without running prepare hook — commit-msg rejects with clear error
  • Merge commit passes without ZIR prefix
  • Verify .githooks/commit-msg and .githooks/prepare-commit-msg are mode 100755 in git: git ls-files --stage .githooks/

🤖 Generated with Claude Code

- Add .githooks/commit-msg: validates ZIR-XXX: format, exempts Merge/Revert
- Add .githooks/prepare-commit-msg: auto-prepends ZIR-000: when prefix missing
- Add scripts/setup-hooks.sh: one-command setup via core.hooksPath
- Add CONTRIBUTING.md documenting the commit format and hook setup

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