diff options
| author | Ben Sima <ben@bsima.me> | 2025-09-04 10:11:30 -0400 |
|---|---|---|
| committer | Ben Sima (aider) <ben@bsima.me> | 2025-09-04 10:11:30 -0400 |
| commit | 34770d0fbf05a85826eb4b635c205dd7281fa660 (patch) | |
| tree | 40806d4f15c399a8d5b3e597a53c67be3bd8c5d5 /Omni/Ide/hooks/commit-msg | |
| parent | 9fe5086a25b5380729bd7292e0042a8abb289e27 (diff) | |
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.
Diffstat (limited to 'Omni/Ide/hooks/commit-msg')
| -rwxr-xr-x | Omni/Ide/hooks/commit-msg | 5 |
1 files changed, 4 insertions, 1 deletions
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 |
