[RFC 2/2] [pre-commit] Require codespell-clean commit messages
Tom de Vries <[email protected]> Sat, 25 Jul 2026 11:02:26 +0200
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
Now that we have an easy method to ignore intentional typos in commit
messages:
...
Fix typo skippig [sic].
...
require commit messages to be codespell-clean.
Still, this may mean that large blocks of verbatim text (for instance
backtraces) might have to be ignored using
codespell:ignore-begin/codespell:ignore-end.
To restart editing after check failure, this command can be used:
...
$ git commit --amend
<codespell-log check failure>
$ git commit --amend -F .git/COMMIT_EDITMSG -e
...
Having your commit abort is somewhat annoying, and I thought of two ways to
make this less annoying:
- add an interactive loop that allows the user to re-edit or ignore the
codespell failure
- in case of codespell failure, add codespell:ignore-begin codespell:ignore-end
around the entire message, and pass
---
.pre-commit-config.yaml | 2 --
gdb/contrib/codespell-log.sh | 20 --------------------
2 files changed, 22 deletions(-)
delete mode 100755 gdb/contrib/codespell-log.sh
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 60164e446fc..76991b7d18a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -87,9 +87,7 @@ repos:
files: &gdb_files '^(gdb|gdbserver|gdbsupport)/'
- id: codespell
name: codespell-log
- entry: gdb/contrib/codespell-log.sh
args: *codespell_args
- verbose: true
stages: [commit-msg]
# Tclint hooks.
diff --git a/gdb/contrib/codespell-log.sh b/gdb/contrib/codespell-log.sh
deleted file mode 100755
index 3e1fc26159a..00000000000
--- a/gdb/contrib/codespell-log.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2025-2026 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Script to be used as commit-msg hook to spell-check the commit log using
-# codespell.
-
-codespell "$@" || true
--
2.51.0