File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/sh
22set -eu
33
4- # Strip Cursor co-author trailer(s) from commit message.
4+ # Strip AI co-author/ trailer lines from commit message.
55# Runs after the message is composed, before the commit is finalized.
66#
77# Usage: enable repo hooks with:
1414
1515tmp=" ${MSG_FILE} .tmp.$$ "
1616
17- # Remove any "Co-authored-by: Cursor ..." trailer lines (case-insensitive).
18- # Keep all other co-authors intact.
17+ # Remove:
18+ # - ALL "Co-authored-by:" trailer lines (case-insensitive)
19+ # - ANY git trailer line mentioning Cursor/cursoragent (case-insensitive)
1920awk '
2021BEGIN { IGNORECASE = 1 }
21- /^[[:space:]]*Co-authored-by:[[:space:]]*Cursor([[:space:]]|<|$)/ { next }
22- /^[[:space:]]*Co-Authored-By:[[:space:]]*Cursor([[:space:]]|<|$)/ { next }
22+ NR==1 { print; next }
23+ /^[[:space:]]*Co-authored-by:[[:space:]]*/ { next }
24+ /^[[:space:]]*[A-Za-z0-9-]+:[[:space:]]+.*(cursoragent|cursor).*/ { next }
2325{ print }
2426' " $MSG_FILE " > " $tmp "
2527
You can’t perform that action at this time.
0 commit comments