Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH] [pre-commit] Fix codespell-log hook
Date: Fri, 17 Jul 2026 13:21:32 +0200	[thread overview]
Message-ID: <9a48d793-2f3e-4ce9-950b-52c48ad1fea0@suse.de> (raw)
In-Reply-To: <20260716165436.1416427-1-tdevries@suse.de>

On 7/16/26 6:54 PM, Tom de Vries wrote:
> A recent commit added this top-level setting to .pre-commit-config.yaml:
> ...
> files: '^(gdb|gdbserver|gdbsupport)/'
> ...
> 
> This broke the codespell-log hook, which is a commit-msg hook, which is called
> with the commit message as first argument.
> 
> However, the top-level files setting filters out .git/COMMIT_EDITMSG, with the
> consequence that the commit-msg hook is no longer called.
> 
> It seems obvious to me that this is a pre-commit bug: the files field is there
> to filter files in the repository, which .git/COMMIT_EDITMSG is not one of.
> But upstream disagrees [1].
> 
> Use the workaround suggested as fix upstream: include .git/COMMIT_EDITMSG in
> the default files set.
> 
> [ FWIW, that still doesn't fix something like this:
> ...
> $ tmp=$(mktemp)
> $ echo 'msg' > $tmp
> $ pre-commit run --hook-stage commit-msg --commit-msg-filename $tmp
> ...
> 
> I wanted to mention that upstream, but I couldn't because I was already locked
> out of commenting on the issue I filed. ]
> 
> Alternatively, we can drop the top-level files setting, and revert to
> per-hook settings.
> 

Writing a regression test for this made me realize that the workaround 
proposed in this patch is not sufficient, so I've committed a v2 ( 
https://sourceware.org/pipermail/gdb-patches/2026-July/228714.html ) 
that reverts to per-hook settings.

Thanks,
- Tom

> [1] https://github.com/pre-commit/pre-commit/issues/3720
> ---
>   .pre-commit-config.yaml | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
> index 2f86a333ab5..fda10e30b1d 100644
> --- a/.pre-commit-config.yaml
> +++ b/.pre-commit-config.yaml
> @@ -40,7 +40,9 @@
>   minimum_pre_commit_version: 4.5.1
>   default_install_hook_types: [pre-commit, commit-msg]
>   default_stages: [pre-commit]
> -files: '^(gdb|gdbserver|gdbsupport)/'
> +# The ^\.git/COMMIT_EDITMSG$ is there to make sure commit-msg hooks work.
> +# See this issue ( https://github.com/pre-commit/pre-commit/issues/3720 ).
> +files: '^(gdb|gdbserver|gdbsupport)/|^\.git/COMMIT_EDITMSG$'
>   
>   repos:
>     # Python hooks.  Run these for (in glob notation):
> 
> base-commit: a4481c8ff808e7237b99815d84b0d4c06ded6124


      reply	other threads:[~2026-07-17 11:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 16:54 Tom de Vries
2026-07-17 11:21 ` Tom de Vries [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a48d793-2f3e-4ce9-950b-52c48ad1fea0@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox