From 34770d0fbf05a85826eb4b635c205dd7281fa660 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 4 Sep 2025 10:11:30 -0400 Subject: Wrap all commit messages with fmt Sometimes aider will write commit messages without wrapping them at 80 chars, and then the commit fails the gitlint hook, and aider can't finish the commit. To fix this I can just auto-wrap before we check it. --- Omni/Ide/hooks/commit-msg | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Omni/Ide/hooks/commit-msg b/Omni/Ide/hooks/commit-msg index e07d1f4..d77ec84 100755 --- a/Omni/Ide/hooks/commit-msg +++ b/Omni/Ide/hooks/commit-msg @@ -1,7 +1,10 @@ #!/usr/bin/env bash +temp=$(mktemp) +fmt -w 72 -s "$1" > "$temp" +mv "$temp" "$1" if ! gitlint --ignore-stdin --staged --msg-filename "$1" run-hook; then backup="$CODEROOT"/.git/COMMIT_EDITMSG.backup - cp "$CODEROOT"/.git/COMMIT_EDITMSG "$backup" + cp "$1" "$backup" echo "error: gitlint failed, saved your commit msg as $backup" exit 1 fi -- cgit v1.2.3