Skip to content

Commit 4939fd5

Browse files
david22swanclaude
andcommitted
(CAT-2609) Match git commit at command boundaries not just start of string
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c132bae commit 4939fd5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

.claude/hooks/no-main-commits.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
. "$(dirname "$0")/_parse_input.sh"
66

7-
if echo "$cmd" | grep -qE '^git commit'; then
7+
if echo "$cmd" | grep -qE '(^|[;&|])\s*git commit'; then
88
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
99
if [ "$branch" = "main" ] || [ "$branch" = "master" ]; then
1010
echo "{\"continue\":false,\"stopReason\":\"Project rule: never work directly on the $branch branch.\"}"

0 commit comments

Comments
 (0)