Skip to content

chore(git): keep Co-Authored-By trailers out of commits made with the beads hooks - #24

Merged
GeiserX merged 1 commit into
mainfrom
chore/beads-commit-msg-hook
Oct 3, 2026
Merged

GeiserX merged 1 commit into
mainfrom
chore/beads-commit-msg-hook

Conversation

@GeiserX

@GeiserX GeiserX commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Clones of this repo set core.hooksPath to .beads/hooks so the tracker's hooks run. That setting turns off the machine-wide git hooks, and one of those removed Co-Authored-By trailers from commit messages. With the tracker hooks on, nothing removed them any more.

This adds one commit-msg hook beside the tracker's wrappers. It deletes lines that start with Co-Authored-By: and the blank lines left at the end. A mention inside a sentence stays.

The hook cannot lose a message. A message without such a line is never touched. Otherwise the cleaned text is written to a fresh temporary file, checked against a second run, and renamed over the message only when every step worked. On any failure the message stays as it was and the commit stops.

Tested before it went anywhere: 780 message, shell, awk and locale combinations, a really full disk, signals arriving mid-run, and 28 real git scenarios. Without the hook the trailer stays.

Summary by CodeRabbit

  • Commit Messages
    • When a commit message contains a Co-Authored-By: line, that line and trailing blank lines are removed before the commit proceeds.
    • If the message cannot be read or updated successfully, the commit is stopped and the original message is left unchanged.

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: GeiserX/slskd-transform/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 01ec4f74-b6f3-4346-ae83-70adbb9a4316
📥 Commits

Reviewing files that changed from the base of the PR and between 0a34016 and e3628a2.

📒 Files selected for processing (1)
  • .beads/hooks/commit-msg

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The new POSIX shell hook detects Co-Authored-By trailer lines in commit messages, removes those lines and trailing blank lines, and replaces the original message only after successful cleaning and comparison.

Changes

Commit message cleanup

Layer / File(s) Summary
Hook processing and safe rewrite
.beads/hooks/commit-msg
The hook skips missing messages and messages without matching trailers. For matching messages, it removes trailer lines and trailing blank lines, then replaces the original only after cleaning and comparison succeed. Errors stop the commit.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to e3628

No actionable issue remains from this review; the change is mergeable after normal checks.

Architecture Summary

Architecture risk: 🔵 Low · up to e3628

The changed surface does not map to a changed system, dependency edge, entrypoint, or external dependency.

Changed systems: None identified.

Architecture concerns
No architecture-level concerns identified.

Review details

Before / after behavior

  • observed — Modified behavior in .beads/hooks/commit-msg: Adds a POSIX shell hook that skips missing files and messages without matching trailers, treats grep errors as fatal, and handles message paths beginning with -. Matching trailer detection is case-insensitive and permits leading whitespace.
  • observed — Modified behavior in .beads/hooks/commit-msg: Adds cleaning that removes lines beginning with an optionally indented, case-insensitive Co-Authored-By: prefix and strips trailing whitespace-only lines from the result.
  • observed — Modified behavior in .beads/hooks/commit-msg: Adds temporary-file creation beside the message, cleanup and signal traps, and a rewrite-and-compare check before replacing the original. Creation, cleaning/comparison, or replacement failures report an error and exit nonzero; the original is not replaced before the final move.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: removing Co-Authored-By trailers from commits made with the beads hooks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@GeiserX
GeiserX merged commit 37c099e into main Oct 3, 2026
7 checks passed
@GeiserX
GeiserX deleted the chore/beads-commit-msg-hook branch October 3, 2026 20:35
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