diff options
Diffstat (limited to 'dot_config/git/hooks')
| -rw-r--r-- | dot_config/git/hooks/_dispatch.sh | 2 | ||||
| -rwxr-xr-x | dot_config/git/hooks/executable_commit-msg | 8 | ||||
| -rwxr-xr-x | dot_config/git/hooks/executable_post-commit | 2 | ||||
| -rwxr-xr-x | dot_config/git/hooks/executable_pre-commit | 2 | ||||
| -rwxr-xr-x | dot_config/git/hooks/executable_pre-push | 2 |
5 files changed, 10 insertions, 6 deletions
diff --git a/dot_config/git/hooks/_dispatch.sh b/dot_config/git/hooks/_dispatch.sh index ed5acbf..9ba6e3b 100644 --- a/dot_config/git/hooks/_dispatch.sh +++ b/dot_config/git/hooks/_dispatch.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env dash # Sourced by every hook in this directory. Runs the per-repo hook of # the same name and then returns control so the calling user-level # hook can do its own work after. diff --git a/dot_config/git/hooks/executable_commit-msg b/dot_config/git/hooks/executable_commit-msg index e484ccb..628ac94 100755 --- a/dot_config/git/hooks/executable_commit-msg +++ b/dot_config/git/hooks/executable_commit-msg @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env dash # Strip Co-authored-by trailers whose identity looks like a coding agent # (Copilot, Claude, Codex, ChatGPT, Cursor, Aider, Devin, ...). Various # tools — GitHub Copilot CLI, VS Code chat, etc. — append these @@ -58,7 +58,11 @@ esac # Collapse any trailing blank lines produced by the removal so we don't # leave a dangling blank trailer block. -sed -e :a -e '/^$/{$d;N;ba' -e '}' "$tmp" >"$msg_file" +awk ' + NF { last = NR } + { lines[NR] = $0 } + END { for (i = 1; i <= last; i++) print lines[i] } +' "$tmp" >"$msg_file" printf 'commit-msg: stripped AI Co-authored-by trailer(s).\n' >&2 exit 0 diff --git a/dot_config/git/hooks/executable_post-commit b/dot_config/git/hooks/executable_post-commit index 45f13f0..69d85f9 100755 --- a/dot_config/git/hooks/executable_post-commit +++ b/dot_config/git/hooks/executable_post-commit @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env dash # User-level post-commit. No global checks — exists purely so that # `<repo>/.githooks/post-commit` gets picked up automatically without # the project needing to override core.hooksPath. If there is no diff --git a/dot_config/git/hooks/executable_pre-commit b/dot_config/git/hooks/executable_pre-commit index 548925b..76d623b 100755 --- a/dot_config/git/hooks/executable_pre-commit +++ b/dot_config/git/hooks/executable_pre-commit @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env dash # User-level pre-commit. No global checks — exists purely so that # `<repo>/.githooks/pre-commit` gets picked up automatically without # the project needing to override core.hooksPath. If there is no diff --git a/dot_config/git/hooks/executable_pre-push b/dot_config/git/hooks/executable_pre-push index 286958b..b0915bf 100755 --- a/dot_config/git/hooks/executable_pre-push +++ b/dot_config/git/hooks/executable_pre-push @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env dash # Reject pushes that include commits which: # * lack a good signature, or # * have a committer different from this repo's user.name / user.email, or |
