aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/git/hooks
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-06-05 11:06:02 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-06-05 11:06:02 +0100
commitb0e83e2ee3fc328e55119ee7c1f09ad7ed20a635 (patch)
tree0208caee2063e471b4b23b0b45038b2bce00e2fa /dot_config/git/hooks
parent4d8cf1bc30a076e2976787051d28d8072f8f5321 (diff)
downloaddotfiles-b0e83e2ee3fc328e55119ee7c1f09ad7ed20a635.tar.gz
dotfiles-b0e83e2ee3fc328e55119ee7c1f09ad7ed20a635.tar.bz2
dotfiles-b0e83e2ee3fc328e55119ee7c1f09ad7ed20a635.zip
Move more host tooling to Nix
Diffstat (limited to 'dot_config/git/hooks')
-rw-r--r--dot_config/git/hooks/_dispatch.sh2
-rwxr-xr-xdot_config/git/hooks/executable_commit-msg8
-rwxr-xr-xdot_config/git/hooks/executable_post-commit2
-rwxr-xr-xdot_config/git/hooks/executable_pre-commit2
-rwxr-xr-xdot_config/git/hooks/executable_pre-push2
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