Repository navigation
Commit 239c026
authored
chore(git): keep Co-Authored-By trailers out of commits made with the beads hooks (#45)
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.1 parent 424ade9 commit 239c026
1 file changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments