[binutils-gdb] [pre-commit] Set default_stages to pre-commit

Tom de Vries vries@sourceware.org
Tue Sep 30 16:45:41 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cb1133022a7b65a291eeb6e06f944ee12df04bb5

commit cb1133022a7b65a291eeb6e06f944ee12df04bb5
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Sep 30 18:45:44 2025 +0200

    [pre-commit] Set default_stages to pre-commit
    
    I realized I was seeing the newly added tclint check twice:
    ...
    $ touch gdb/testsuite/gdb.base/foo.exp
    $ git add gdb/testsuite/gdb.base/foo.exp
    $ git commit -a -m foo 2>&1 | grep tclint
    tclint..................................................................Passed
    tclint..............................................(no files to check)Skipped
    $
    ...
    
    The hook is run once for stage pre-commit, and once for stage commit-msg.
    
    Since the hook doesn't specify a stage at which it's supposed to be run, it
    takes its default from default_stages, which defaults to all stages.
    
    Fix this by setting default_stages to pre-commit:
    ...
    $ git commit -a -m foo 2>&1 | grep tclint
    tclint..................................................................Passed
    $
    ...
    
    The only hook sofar that needs a different stage than pre-commit is
    codespell-log, and it's not affected by this change because it has an explicit
    "stages: [commit-msg]" setting.
    
    Approved-By: Tom Tromey <tom@tromey.com>

Diff:
---
 .pre-commit-config.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 8217bad0a0a..33e3f2b8900 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -39,6 +39,7 @@
 
 minimum_pre_commit_version: 3.2.0
 default_install_hook_types: [pre-commit, commit-msg]
+default_stages: [pre-commit]
 repos:
   - repo: https://github.com/psf/black-pre-commit-mirror
     rev: 25.9.0


More information about the Binutils-cvs mailing list