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: [PATCH 4/5] [pre-commit] Don't require text type for check-whitespace hook
Date: Mon, 20 Jul 2026 14:50:55 +0200	[thread overview]
Message-ID: <20260720125056.1373177-5-tdevries@suse.de> (raw)
In-Reply-To: <20260720125056.1373177-1-tdevries@suse.de>

The check-whitespace hook has a line:
...
types: ['text']
...

Drop this, to make the check-whitespace hook see the same files as git usage
outside pre-commit:
...
$ git diff-index --cached --check $(git hash-object -t tree /dev/null) gdb*
...

Instead, add .gitattributes files in gdb/doc and gdb/testsuite.

https://sourceware.org/bugzilla/show_bug.cgi?id=34411
---
 .pre-commit-config.yaml      |  5 ++++-
 gdb/doc/.gitattributes       | 10 ++++++++++
 gdb/testsuite/.gitattributes |  4 ++++
 3 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 gdb/doc/.gitattributes
 create mode 100644 gdb/testsuite/.gitattributes

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b437593b228..260cae67e56 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -129,7 +129,10 @@ repos:
       name: *id2
       language: unsupported_script
       entry: gdb/contrib/check-whitespace-pre-commit.py
-      types: ['text']
+      # Don't filter files on types, allowing this hook to see same files as
+      # git usage outside pre-commit. Instead, filter files in the entry point.
+      types: *types_default
+      types_or: *types_or_default
       files: *gdb_files
     - id: &id3 pre-commit-setup
       name: *id3
diff --git a/gdb/doc/.gitattributes b/gdb/doc/.gitattributes
new file mode 100644
index 00000000000..735e4eef89a
--- /dev/null
+++ b/gdb/doc/.gitattributes
@@ -0,0 +1,10 @@
+# -*- conf -*-
+
+# Binary format.
+*.pdf  binary
+*.png  binary
+
+# Text format, but diffs aren't useful.
+# Note that stack_frame.eps is an EPS file without embedded bitmap preview.
+*.svg  text -diff
+stack_frame.eps  text -diff
diff --git a/gdb/testsuite/.gitattributes b/gdb/testsuite/.gitattributes
new file mode 100644
index 00000000000..97a376c1938
--- /dev/null
+++ b/gdb/testsuite/.gitattributes
@@ -0,0 +1,4 @@
+# -*- conf -*-
+
+# Binary format.
+*.bz2  binary
-- 
2.51.0


  parent reply	other threads:[~2026-07-20 12:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 12:50 [PATCH 0/5] [pre-commit] Some pre-commit improvements Tom de Vries
2026-07-20 12:50 ` [PATCH 1/5] [gdb] Fix bare except in gdb/gdb-gdb.py.in Tom de Vries
2026-07-20 12:50 ` [PATCH 2/5] [gdb] Remove superfluous global " Tom de Vries
2026-07-20 12:50 ` [PATCH 3/5] [pre-commit] Run flake8 for gdb/gdb-gdb.py.in Tom de Vries
2026-07-20 12:50 ` Tom de Vries [this message]
2026-07-20 12:50 ` [PATCH 5/5] [pre-commit] Don't require text type for codespell hook Tom de Vries

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=20260720125056.1373177-5-tdevries@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