File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,16 +8,9 @@ if [ "$COMMIT_SOURCE" = "merge" ] || [ "$COMMIT_SOURCE" = "squash" ]; then
88 exit 0
99fi
1010
11- # Strip Co-authored-by lines
12- sed -i.bak " /^Co-authored-by:/d" " $COMMIT_MSG_FILE " 2> /dev/null || \
13- sed -i " /^Co-authored-by:/d" " $COMMIT_MSG_FILE "
11+ # Strip Co-authored-by lines (portable sed — works on macOS and Linux).
12+ sed ' /^[Cc]o-[Aa]uthored-[Bb]y:/d' " $COMMIT_MSG_FILE " > " ${COMMIT_MSG_FILE} .tmp" && mv " ${COMMIT_MSG_FILE} .tmp" " $COMMIT_MSG_FILE "
1413
15- # Remove trailing blank lines
16- sed -i.bak -e :a -e " /^
17- *$/{$d ;N;ba" -e " }" " $COMMIT_MSG_FILE " 2> /dev/null || \
18- sed -i -e :a -e " /^
19- *$/{$d ;N;ba" -e " }" " $COMMIT_MSG_FILE "
20-
21- # Clean up backup files
22- rm -f " ${COMMIT_MSG_FILE} .bak"
14+ # Remove trailing blank lines.
15+ sed -e :a -e ' /^\n*$/{$d;N;ba' -e ' }' " $COMMIT_MSG_FILE " > " ${COMMIT_MSG_FILE} .tmp" 2> /dev/null && mv " ${COMMIT_MSG_FILE} .tmp" " $COMMIT_MSG_FILE " || true
2316
Original file line number Diff line number Diff line change 2424.commandcode /
2525.DS_Store
2626coverage.out
27+
28+ # Lefthook-generated wrappers (tracked .githooks/prepare-commit-msg is canonical)
29+ .githooks /commit-msg
30+ .githooks /pre-push
31+ .githooks /pre-commit.old
Original file line number Diff line number Diff line change @@ -116,3 +116,12 @@ commit-msg:
116116 # Strip Co-authored-by: trailers that AI tools (Claude, Cursor, etc.) add.
117117 # This enforces the rule that commits list only the human author.
118118 sed '/^[Cc]o-[Aa]uthored-[Bb]y:/d' "{1}" > "{1}.tmp" && mv "{1}.tmp" "{1}"
119+
120+ # ---------------------------------------------------------------------------
121+ # prepare-commit-msg — strip AI co-author trailers after tools inject them.
122+ # ---------------------------------------------------------------------------
123+ prepare-commit-msg :
124+ commands :
125+ strip-co-authored-by :
126+ run : |
127+ sed '/^[Cc]o-[Aa]uthored-[Bb]y:/d' "{1}" > "{1}.tmp" && mv "{1}.tmp" "{1}"
You can’t perform that action at this time.
0 commit comments