aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/git/hooks/executable_commit-msg
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/executable_commit-msg
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/executable_commit-msg')
-rwxr-xr-xdot_config/git/hooks/executable_commit-msg8
1 files changed, 6 insertions, 2 deletions
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